kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.42k stars 8.24k forks source link

kubectl plugin cannot be installed on Apple Silicon (darwin/arm64) #8194

Closed iben12 closed 2 years ago

iben12 commented 2 years ago

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.): n/a

Kubernetes version (use kubectl version): Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/arm64"}

Environment:

What happened:

I tried to install the kubectl plugin for ingress-nginx as described in the docs:

kubectl krew install ingress-nginx
Updated the local copy of plugin index.
Installing plugin: ingress-nginx
W0126 13:21:27.097874   59776 install.go:164] failed to install plugin "ingress-nginx": plugin "ingress-nginx" does not offer installation for this platform
F0126 13:21:27.098127   59776 root.go:79] failed to install some plugins: [ingress-nginx]: plugin "ingress-nginx" does not offer installation for this platform

My krew seems to be intalled correctly:

kubectl krew version 
OPTION            VALUE
GitTag            v0.4.2
GitCommit         6fcdb79
IndexURI          https://github.com/kubernetes-sigs/krew-index.git
BasePath          /Users/me/.krew
IndexPath         /Users/me/.krew/index/default
InstallPath       /Users/me/.krew/store
BinPath           /Users/me/.krew/bin
DetectedPlatform  darwin/arm64

What you expected to happen:

Plugin is installed

How to reproduce it: See above

Anything else we need to know: As I see in the krew plugin manifest here this should work, the plugin has darwin/arm64 build.

I can install other plugins.

k8s-ci-robot commented 2 years ago

@iben12: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
tao12345666333 commented 2 years ago

Thanks! kubectl plugin has not been updated for a long time. I will deal with it ASAP.

We can using #7627 for tracking.

winnieoursbrun commented 2 years ago

Workaround for lonely souls:

git clone git@github.com:kubernetes/ingress-nginx.git && cd ingress-nginx

make build-plugin && cd cmd/plugin/release/
nano ingress-nginx.yaml # Need to remove on `v` for version number line `9`, issue #8217 
tar xf kubectl-ingress_nginx-darwin-arm64.tar.gz
kubectl krew install --manifest=ingress-nginx.yaml --archive=kubectl-ingress_nginx-darwin-arm64.tar.gz
symbl-ay commented 2 years ago

For those of us on macbooks and podman, I've modified the Makefile target for run-in-docker to skip the options that work on my machine. Make sure you let podman know that your home directory is available for mounts.

# assumes default machine name...
podman machine init --cpus=4 --memory=4096 -v $HOME:$HOME
# source: github.com/kubernetes/ingress-nginx@529844886
# source: build/run-in-docker.sh
#
# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
make_build_plugin() {
    # temporal directory for the /etc/ingress-controller directory
    INGRESS_VOLUME="$(PWD)/vol/etc/ingress-controller"

    # make sure directory for SSL cert storage exists under ingress volume
    mkdir "${INGRESS_VOLUME}/ssl"

    E2E_IMAGE=${E2E_IMAGE:-k8s.gcr.io/ingress-nginx/e2e-test-runner:v20220110-gfd820db46@sha256:273f7d9b1b2297cd96b4d51600e45d932186a1cc79d00d179dfb43654112fe8f}

    DOCKER_OPTS=${DOCKER_OPTS:-}

    KUBE_ROOT="$(pwd)"
    PKG=k8s.io/ingress-nginx
    ARCH="$(arch)"
    COMMIT_SHA="$(git rev-parse --short HEAD)"
    REPO_INFO="$(git config --get remote.origin.url)"
    TAG="v1.1.2"
    FLAGS="GOBUILD_FLAGS='--tags netgo' PKG=$PKG ARCH=$ARCH COMMIT_SHA=$COMMIT_SHA REPO_INFO=$REPO_INFO TAG=$TAG"

    # create output directory as current user to avoid problem with docker.
    mkdir -p "${KUBE_ROOT}/bin" "${KUBE_ROOT}/bin/${ARCH}"

    docker run -i                                              \
           --tty                                               \
           --rm                                                \
           -e GOCACHE="/go/src/${PKG}/.cache"                  \
           -e GOMODCACHE="/go/src/${PKG}/.modcache"            \
           -e DOCKER_IN_DOCKER_ENABLED="true"                  \
           -v "${HOME}/.kube:${HOME}/.kube"                    \
           -v "${KUBE_ROOT}:/go/src/${PKG}"                    \
           -v "${KUBE_ROOT}/bin/${ARCH}:/go/bin/linux_${ARCH}" \
           -v "${INGRESS_VOLUME}:/etc/ingress-controller/"     \
           -w "/go/src/${PKG}"                                 \
           "${E2E_IMAGE}" /bin/bash -c "$FLAGS /go/src/${PKG}/build/build-plugin.sh"

}

mkdir -p ~/tmp
_tmp="$(mktemp -d ~/tmp/sre.XXXXXX)"
git clone https://github.com/kubernetes/ingress-nginx.git "$_tmp"
cd "$_tmp" || exit 1
make_build_plugin
cd cmd/pluin/release/ || exit 1
kubectl krew install --manifest=ingress-nginx.yaml --archive=kubectl-ingress_nginx-darwin-arm64.tar.gz

I noticed that the "vv" bug was fixed, so that's no longer an issue. Thankfully, I didn't have to add sed anywhere to my script otherwise it might have been too much to bother with.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

tpoindessous commented 2 years ago

/remove-lifecycle rotten

twixthehero commented 2 years ago

Workaround for lonely souls:

git clone git@github.com:kubernetes/ingress-nginx.git && cd ingress-nginx

make build-plugin && cd cmd/plugin/release/
nano ingress-nginx.yaml # Need to remove on `v` for version number line `9`, issue #8217 
tar xf kubectl-ingress_nginx-darwin-arm64.tar.gz
kubectl krew install --manifest=ingress-nginx.yaml --archive=kubectl-ingress_nginx-darwin-arm64.tar.gz

thanks. before running make, i needed to set GOBUILD_FLAGS in build/build-plugin.sh before go build was being run

Starefossen commented 2 years ago

The solution to @twixthehero is no longer working. No build target for plugin any more.

gsimko commented 2 years ago

@Starefossen Syncing back to c85765a015ea6709d161eccd42ef6134981c04b4 (just before 2022 Aug 11th) helps with that, though I'm not sure what critical updates we are missing by doing that.

evenh commented 1 year ago

Might be blocked by #8812

timown commented 1 year ago

it's still an issue, right? getting

failed to install some plugins: [ingress-nginx]: plugin "ingress-nginx" does not offer installation for this platform
ContainerCat commented 1 year ago

Also still an issue for me on darwin/arm64

LittleHoopoe commented 1 year ago

can we get a darwin/arm64 version? :) Would be so beautiful

joeloplot commented 1 year ago

Still a problem in August 2023 Why is this closed? Please reopen.

absolutejam commented 4 months ago

As a workaround, you can manually build it yourself without much ceremony:

cd cmd/plugin && go build -o /usr/local/bin/kubectl-ingress_nginx
niwong-nmnl commented 1 day ago

The command in this comment also worked for me: https://github.com/kubernetes/ingress-nginx/issues/10315#issuecomment-1678576923