Install kubectl on a Mac M1
First, clone the Kubernetes repository with the following command:
git clone https://github.com/kubernetes/kubernetes
Then go to the following subdirectory:
Here we open the following file:
And search this section:
readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=( linux/amd64 linux/386 linux/arm linux/arm64 linux/s390x linux/ppc64le darwin/amd64 windows/amd64 windows/386 )
Now we need to add only one line:
And save the file. Now we change to the root directory of the project and run the following command:
Now a build process should start which builds kubectl for us.
At this point we may get an error telling us that we don't have Go installed. We can easily install this with the following command (if you have brew installed):
brew install go
If everything worked, you should now be able to use kubectl.