Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of kubernettes-101 episodes against Apple M1 build #20

Closed
kientran opened this issue Jan 24, 2021 · 12 comments
Closed

Validation of kubernettes-101 episodes against Apple M1 build #20

kientran opened this issue Jan 24, 2021 · 12 comments

Comments

@kientran
Copy link
Sponsor

With the release of Docker Preview for M1, Go 1.16beta1 for M1, and minikube v1.17.0 test, we can now run Minikube on an M1 with native ARM packages as per kubernetes/minikube#9224

  • Kubectl comes from Docker's M1 preview builds
  • An M1 build Go-lang formula is available in the M1 Brew preview. While it installs "1.15.7", it's actually 1.16beta1

I've tested episode-01 and it works fine.

❯ go version
go version go1.16beta1 darwin/arm64
❯ ./out/minikube version
minikube version: v1.17.0
commit: b1ccf54f8327aa0dc5421f92f49af057e8e9ebee
❯ ./out/minikube start --driver=docker
😄  minikube v1.17.0 on Darwin 11.1 (arm64)
✨  Using the docker driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🤷  docker "minikube" container is missing, will recreate.
🔥  Creating docker container (CPUs=2, Memory=1981MB) ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.2 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
❯ kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    <none>   41s   v1.20.2
❯ kubectl create deployment hello-k8s --image=geerlingguy/kube101:intro
deployment.apps/hello-k8s created
❯ kubectl expose deployment hello-k8s --type=NodePort --port=80
service/hello-k8s exposed
❯ ./out/minikube service hello-k8s
|-----------|-----------|-------------|---------------------------|
| NAMESPACE |   NAME    | TARGET PORT |            URL            |
|-----------|-----------|-------------|---------------------------|
| default   | hello-k8s |          80 | http://192.168.49.2:31305 |
|-----------|-----------|-------------|---------------------------|
🏃  Starting tunnel for service hello-k8s.
|-----------|-----------|-------------|------------------------|
| NAMESPACE |   NAME    | TARGET PORT |          URL           |
|-----------|-----------|-------------|------------------------|
| default   | hello-k8s |             | http://127.0.0.1:56603 |
|-----------|-----------|-------------|------------------------|
🎉  Opening service default/hello-k8s in default browser...
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
@kientran
Copy link
Sponsor Author

kientran commented Jan 24, 2021

Episode 02 works without issue as expected

❯ go version
go version go1.16beta1 darwin/arm64
❯ go run cmd/hello/hello.go
2021/01/24 01:15:06 Starting webserver on :8180
2021/01/24 01:15:20 Received request for path: /some-path-here
2021/01/24 01:15:20 Received request for path: /favicon.ico
^Csignal: interrupt
❯ go build cmd/hello/hello.go
❯ ls
Dockerfile	README.md	cmd		hello
❯ ./hello
2021/01/24 01:15:49 Starting webserver on :8180
2021/01/24 01:16:13 Received request for path: /some-path-here

❯ docker build -t geerlingguy/kube101-go .
[+] Building 19.5s (15/15) FINISHED 
❯ docker run --rm -p 8180:8180 geerlingguy/kube101-go
2021/01/24 07:17:50 Starting webserver on :8180
2021/01/24 07:17:54 Received request for path: /
2021/01/24 07:17:54 Received request for path: /favicon.ico
2021/01/24 07:17:54 Received request for path: /some-path-here

@geerlingguy
Copy link
Owner

Nice!

@Andreigr0
Copy link

How did you make it to work? I've repeated steps and got an error kubernetes/minikube#10310 (comment)

@kientran
Copy link
Sponsor Author

I had no issue using the now available binaries from kuberneties. Make sure you have docker running.

@kientran
Copy link
Sponsor Author

kientran commented Feb 17, 2021

Episode 03 worked without issue. Things to note when using docker on an M1 with minikube

  • If you don't want to push up to docker hub or use Linode, you'll need to set minikube to use the local docker desktop repository by eval $(minikube -p minikube docker-env) with admittedly breaks the whole lesson of adding the DockerHub secrets. You will also need to use minikube service hello-go --url to enable a proxy and reach the internal docker containers
  • Minikube now has a direct build available
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
sudo install minikube-darwin-arm64 /usr/local/bin/minikube

@kientran
Copy link
Sponsor Author

kientran commented Feb 17, 2021

Episode 4 has a number of issues.

  • Vagrant - This is unsupported at this time as there is no Virtualbox support for M1 hosts and no mature vm configs using the OS X virtualization layer.
  • Bitnami Drupal's Apache only supports AMD64 - The Helm scripts and underlying bitnami project use an apache build that only works with amd64. The mariaDB and the Drupal setup scripts seem to work ok based on logs.
kubectl logs -f mysite-drupal-794b56f584-9bx7j
drupal 22:10:02.68 
drupal 22:10:02.70 Welcome to the Bitnami drupal container
drupal 22:10:02.72 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-drupal
drupal 22:10:02.73 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-drupal/issues
drupal 22:10:02.75 
drupal 22:10:02.78 INFO  ==> ** Starting Drupal setup **
drupal 22:10:02.96 INFO  ==> Configuring the HTTP port
drupal 22:10:03.07 INFO  ==> Configuring the HTTPS port
drupal 22:10:03.22 INFO  ==> Configuring PHP options
drupal 22:10:03.32 INFO  ==> Validating settings in MYSQL_CLIENT_* env vars
drupal 22:10:03.55 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
drupal 22:10:03.81 INFO  ==> Restoring persisted Drupal installation
drupal 22:10:04.18 INFO  ==> Trying to connect to the database server
drupal 22:10:09.81 INFO  ==> ** Drupal setup finished! **

drupal 22:10:09.89 INFO  ==> ** Starting Apache **
[Wed Feb 17 22:10:10.040925 2021] [core:emerg] [pid 1] (95)Operation not supported: AH00023: Couldn't create the mpm-accept mutex 
(95)Operation not supported: could not create accept mutex
AH00015: Unable to open logs

Else, everything works! Note, if using local docker, you still need to use minikube service -n drupal drupal --url to open a proxy.

@nhat416
Copy link

nhat416 commented Mar 17, 2021

With the release of Docker Preview for M1, Go 1.16beta1 for M1, and minikube v1.17.0 test, we can now run Minikube on an M1 with native ARM packages as per kubernetes/minikube#9224

  • Kubectl comes from Docker's M1 preview builds
  • An M1 build Go-lang formula is available in the M1 Brew preview. While it installs "1.15.7", it's actually 1.16beta1

I've tested episode-01 and it works fine.

❯ go version
go version go1.16beta1 darwin/arm64
❯ ./out/minikube version
minikube version: v1.17.0
commit: b1ccf54f8327aa0dc5421f92f49af057e8e9ebee
❯ ./out/minikube start --driver=docker
😄  minikube v1.17.0 on Darwin 11.1 (arm64)
✨  Using the docker driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🤷  docker "minikube" container is missing, will recreate.
🔥  Creating docker container (CPUs=2, Memory=1981MB) ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.2 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
❯ kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    <none>   41s   v1.20.2
❯ kubectl create deployment hello-k8s --image=geerlingguy/kube101:intro
deployment.apps/hello-k8s created
❯ kubectl expose deployment hello-k8s --type=NodePort --port=80
service/hello-k8s exposed
❯ ./out/minikube service hello-k8s
|-----------|-----------|-------------|---------------------------|
| NAMESPACE |   NAME    | TARGET PORT |            URL            |
|-----------|-----------|-------------|---------------------------|
| default   | hello-k8s |          80 | http://192.168.49.2:31305 |
|-----------|-----------|-------------|---------------------------|
🏃  Starting tunnel for service hello-k8s.
|-----------|-----------|-------------|------------------------|
| NAMESPACE |   NAME    | TARGET PORT |          URL           |
|-----------|-----------|-------------|------------------------|
| default   | hello-k8s |             | http://127.0.0.1:56603 |
|-----------|-----------|-------------|------------------------|
🎉  Opening service default/hello-k8s in default browser...
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

@kientran I can also verify that this works on Mac M1. I installed Minikube and kubectl using HomeBrew though not Minikube binary. On the first try (running Minikube start) it hangs and has exit error but after I restarted the computer and installed go lang it works.

@stale
Copy link

stale bot commented Jun 16, 2021

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@stale stale bot added the stale label Jun 16, 2021
@kientran
Copy link
Sponsor Author

Resolving as M1 support is generally available. Individual issues should be open as they are found

@stale
Copy link

stale bot commented Jun 16, 2021

This issue is no longer marked for closure.

@stale stale bot removed the stale label Jun 16, 2021
@geerlingguy
Copy link
Owner

Plus I now have two M1 Macs, so I'll definitely be fixing things when I find an issue :D

@geerlingguy
Copy link
Owner

@kientran - Also thanks again for posting this issue—I've actually added a note in Chapter 3 at the first point where things will not work correctly on M1 Macs (at least for now): when you try to access the minikube ip and an exposed nodeport, you get nothing since the Docker driver's networking support can't punch through.

So I added a note that the easiest way on M1/Apple Silicon Macs to get to services in Minikube is via minikube service [service name].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants