yahoo / kubectl-flame

Kubectl plugin for effortless profiling on kubernetes
Apache License 2.0
787 stars 94 forks source link

Issue installing flame on M1 chips #74

Open lavelle96 opened 2 years ago

lavelle96 commented 2 years ago

Hello,

I'm having trouble installing flame on my macbook with an M1 chip, encountering this issue

image

Is anyone else having this issue? If it's a known issue, any idea if there will be a fix?

willianmk commented 1 year ago

Hi @lavelle96 ,

There is a workaround for it, as I also faced the same issue, because on their manifest it is limited to amd64 architecture. Setting the env vars KREW_OS and KREW_ARCH worked for me:

KREW_OS="darwin" KREW_ARCH="amd64" kubectl krew install flame
nishthagoel99 commented 1 year ago

Hi @lavelle96 ,

There is a workaround for it, as I also faced the same issue, because on their manifest it is limited to amd64 architecture. Setting the env vars KREW_OS and KREW_ARCH worked for me:

KREW_OS="darwin" KREW_ARCH="amd64" kubectl krew install flame

When i try to run kubectl flame ,it gives

kubectl flame Error: bad CPU type in executable

How do i solve this?

anoushk1234 commented 1 year ago

@edeNFed Having the same issue

mandrean commented 1 year ago

Fix: https://github.com/yahoo/kubectl-flame/pull/87

gokalper commented 4 months ago

you can build and install manually on apple silicon :

# CLONE THE REPO

export PLUGIN_VERSION=v0.2.4
export PLUGIN_COMMIT=dede84c3ad0857ce5a53be8aeb09ae70b253fcfa
export PLUGIN_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")

CGO_ENABLED=0 GOOS=darwin go build -ldflags "-X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.semver=$PLUGIN_VERSION -X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.date=$PLUGIN_DATE -X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.commit=$PLUGIN_COMMIT" -o kubectl-flame ./cli/main.go

zip kubectl-flame.zip kubectl-flame LICENSE
export PLUGIN_SHA=$(shasum -a 256 kubectl-flame.zip | awk '{print $1}')

cat <<EOF > manifest.yaml
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
  name: flame
spec:
  version: $PLUGIN_VERSION
  homepage: https://github.com/VerizonMedia/kubectl-flame
  shortDescription: A Kubernetes plugin for flame graph generation.
  platforms:
    - uri: https://localhost:8000/kubectl-flame.zip
      sha256: $PLUGIN_SHA
      bin: kubectl-flame
      files:
        - from: kubectl-flame
          to: .
        - from: LICENSE
          to: .
      selector:
        matchLabels:
          os: darwin
          arch: arm64
EOF

# IN THE ROOT FOLDER RUN
python3 -m http.server

# IN A NEW TERMINAL AT THE ROOL FOLDER RUN
kubectl krew install --manifest=manifest.yaml --archive=kubectl-flame.zip