-
Notifications
You must be signed in to change notification settings - Fork 140
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
Error running cluster on M1 / ARM Mac OS for local development #2929
Comments
If you're getting what looks like a functional cluster from
Also if I look at the crds in the cluster I see the following. I'm including this because I'm wondering if they were not created as they should have been based on the error you've received.
|
Hello @tmjd. I was able to fix the previous error and get to the exact state that you are in. At that moment, the cluster nodes were in a So, after installing the default custom resource with
Here the Events from the pods show
Specifically this error
So, what needs to be done to fix this when it is trying to fetch Note that, |
I was able to resolve the operator/pkg/components/calico.go Line 56 in 077f748
So currently everything is up and running:
So, in summary, to set up the cluster in
Would you briefly direct if these changes need to be reflected in the source via pull request to support local development on M1 or if this issue needs other approaches due to some side effects? |
I expect 1 and 2 would be fine. 3 wouldn't be ideal because I think latest is probably the 'latest' released images which would not be the same as using master images. I'm guessing the issue is that only the amd64 images are built and pushed for master builds so the arm images are not available. |
For 3, yes, the 'latest' released image may cause issues compared to stable and tested 'master' images. But as this Additionally, is a pull request needed with changes made in 1 and 2? |
Sorry there hasn't been any response here for a while. For 1: For 2:
I don't think that is something we would want in general, since it would no longer be containerized which is something we want to maintain. I'd be ok with a conditional based on BUILDOS, perhaps if BUILDOS != linux then instruct user to copy a functional kind binary to For 3:
|
For 1: ok For 2:
As the Though might miss some cornercases.
Does this look ok in the case of conditional based on $(BINDIR)/kind:
ifeq ($(BUILDOS), darwin)
sh -c "GOBIN=/go/src/$(PACKAGE_NAME)/$(BINDIR) go install sigs.k8s.io/kind"
else
$(CONTAINERIZED) $(CALICO_BUILD) sh -c "GOBIN=/go/src/$(PACKAGE_NAME)/$(BINDIR) go install sigs.k8s.io/kind"
endif For 3: # https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux/4247319#4247319
set-calico-version:
ifeq ($(BUILDOS), darwin)
sed -i '' -e 's/version: .*/version: $(VERSION)/' config/calico_versions.yml
else
sed -i -e 's/version: .*/version: $(VERSION)/' config/calico_versions.yml
endif
make gen-versions-calico Should go with the following changes? |
I'm good with what you're suggesting For 2, though I'll point out that I don't think you should include GOBIN in the command. Seems reasonable for 3 also. |
On another thought, shouldn't adopting nix would solve compatibility issues altogether? |
$(BINDIR)/kind:
ifeq ($(BUILDOS), darwin)
sh -c go install sigs.k8s.io/kind"
else
$(CONTAINERIZED) $(CALICO_BUILD) sh -c go install sigs.k8s.io/kind"
endif Like this? I will give a PR with these fix then. |
I'd guess there is probably no need for the
I'm not sure, we still need to build |
Does this look ok? $(BINDIR)/kind:
ifeq ($(BUILDOS), darwin)
go install sigs.k8s.io/kind
else
$(CONTAINERIZED) $(CALICO_BUILD) go install sigs.k8s.io/kind
endif
Being universal, it should. I have used it for consistent environment for building Docker images. |
That does not look ok, I didn't notice you were modifying the "non-darwin" command, it should remain what it has been. Have you tried what you're suggesting for the "darwin" option? It doesn't look like it would work to me. The result of the commands should result in a kind binary (that works on the host system) at $(BINDIR)/kind. You probably do need a GOBIN but it would be different from the "non-darwin" command. Please put up a PR that you've tested, ensure you run
But this is not building a Docker image, we're installing a binary that is used. So I don't understand how using nix would help us fetch a darwin binary on darwin and a linux binary on linux. |
I am currently following the steps outlined in this guide to create a local cluster for development purposes. However, I'm encountering errors when executing kind and kubectl, which are essential for creating and managing the cluster.
The errors I'm facing include:
build/_output/bin/kind: cannot execute binary file
exec format error: ./build/_output/bin/kubectl
Expected Behavior
The cluster should be created when I run
make cluster-create
, followed by interacting with it throughkubectl
Current Behavior
The first step
make cluster-create
fails with the aforementioned errors.Possible Solution
I suspect the issue might be related to compatibility with Apple Silicon (M1). In an attempt to resolve this, I made changes to the Makefile. It sort of got the cluster up and running though followed by an error in a later step:
I am explaining the rationale behind my changes.
make cluster-create
command depends onkubectl
andkind
so those os specific binaries are fetched beforehand.kubectl
curl -L https://storage.googleapis.com/kubernetes-release/release/v1.25.6/bin/linux/$(ARCH)/kubectl
where linux is hardcoded.BUILDOS
variable already present in our makefile but there is no use for it. So I replacedlinux/$(ARCH)/kubectl
with$(BUILDOS)/$(ARCH)/kubectl
to make it OS independent.kind
sh -c "GOBIN=$(CURDIR)/$(BINDIR) go install sigs.k8s.io/kind"
, ensuring that I had a MacOS-compatible kind binary available.$(CONTAINERIZED) $(CALICO_BUILD) sh -c "GOBIN=/go/src/$(PACKAGE_NAME)/$(BINDIR) go install sigs.k8s.io/kind"
kind
binary is downloaded inside the Linux-based Docker container and then stored in thebuild/_output/bin
directory, which is mounted inside the container with read/write permissions. This setup allows the binary to be accessible both inside and outside the container, essentially persisting the Linux distribution for later use.kind create cluster
is invoked, I have akind
binary for linux which is not compatible.kind control plane
somehow as I am getting this error when I run the operator against the local cluster described below?This
KUBECONFIG=./kubeconfig.yaml go run ./ --enable-leader-election=false
command is not working as expected and gives the following error.Am I heading in the right direction or what should I do to run the cluster on Apple Silicon (M1)?
Steps to Reproduce (for bugs)
Context
I am trying to make a local cluster for development purposes.
Your Environment
The text was updated successfully, but these errors were encountered: