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

Cannot enable Hubble if Cilium is originally deployed with Hubble disabled #959

Closed
carloruiz opened this issue Jul 7, 2022 · 12 comments · Fixed by #1020
Closed

Cannot enable Hubble if Cilium is originally deployed with Hubble disabled #959

carloruiz opened this issue Jul 7, 2022 · 12 comments · Fixed by #1020
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind/bug Something isn't working kind/community-report This was reported by a user in the Cilium community, eg via Slack.

Comments

@carloruiz
Copy link

carloruiz commented Jul 7, 2022

Bug report

General Information

  • Cilium CLI version (run cilium version)
$ cilium version
cilium-cli: v0.11.4 compiled with go1.18.1 on darwin/amd64
cilium image (default): v1.11.3
cilium image (stable): v1.11.6
cilium image (running): v1.11.4
  • Orchestration system version in use (e.g. kubectl version, ...)
kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.15-gke.9900", GitCommit:"750002971a60d8a06e0a403c52724257f0f68481", GitTreeState:"clean", BuildDate:"2022-06-07T09:26:11Z", GoVersion:"go1.15.15b5", Compiler:"gc", Platform:"linux/amd64"}
  • Platform: GKE 1.20.15

How to reproduce the issue

  1. Deploy Cilium on GKE following the steps here. Add the additional flags --set operator.replicas=1 --set hubble.enabled=false. Here's the full command.
helm template cilium cilium/cilium --version 1.11.4 \
 --namespace kube-system \
 --set nodeinit.enabled=true \
 --set nodeinit.reconfigureKubelet=true \
 --set nodeinit.removeCbrBridge=true \
 --set cni.binPath=/home/kubernetes/bin \
 --set gke.enabled=true \
 --set ipam.mode=kubernetes \
 --set ipv4NativeRoutingCIDR=$NATIVE_ROUTING_CIDR \
 --set operator.replicas=1 \
 --set hubble.enabled=false > cilium-resources.yaml
  1. kubectl apply -f cilium-resources.yaml

  2. Once Cilium is up and running, run cilium hubble enable. The following error will occur:

🔑 Found CA in secret cilium-ca

Error: Unable to enable Hubble:  unable to retrieve helm values secret kube-system/cilium-cli-helm-values: secrets "cilium-cli-helm-values" not found

I would expect to be able to enable hubble even if the initial installation setting was hubble.enabled=false.

@carloruiz carloruiz added the kind/bug Something isn't working label Jul 7, 2022
@sayboras
Copy link
Member

the error looks similar, we have a few fixes below, but it's might not fix for hubble enable CLI. Can you give it a crack with latest master branch and confirm if the issue is resolved ? Thanks.

#904

@olga-mir
Copy link
Contributor

olga-mir commented Aug 2, 2022

Hi @sayboras I am not the issue author, but I had the same error when installing cilium with helm. Latest main doesn't seem to solve it:

 % cilium version
cilium-cli: v0.12.0-18-g6b5553ee compiled with go1.18.5 on darwin/amd64
cilium image (default): v1.12.0
cilium image (stable): v1.12.0
cilium image (running): v1.12.0
% cilium hubble enable

Error: Unable to enable Hubble: unable to retrieve helm values secret kube-system/cilium-cli-helm-values: secrets "cilium-cli-helm-values" not found

@sayboras
Copy link
Member

sayboras commented Aug 4, 2022

Confirmed that it's still happening, just curious if any of you both is planning to contribute. Thanks.

$ cilium hubble enable

Error: Unable to enable Hubble: unable to retrieve helm values secret kube-system/cilium-cli-helm-values: secrets "cilium-cli-helm-values" not found

cilium-cli: v0.12.1 compiled with go1.18.4 on linux/amd64
cilium image (default): v1.12.0
cilium image (stable): v1.12.0
cilium image (running): -ci:latest

@sayboras sayboras added help wanted Extra attention is needed kind/community-report This was reported by a user in the Cilium community, eg via Slack. good first issue Good for newcomers labels Aug 4, 2022
@olga-mir
Copy link
Contributor

olga-mir commented Aug 5, 2022

@sayboras I would love to! I already tried this earlier and have disable working, but enable is not yet complete. I'll have more free time this weekend and I can put the PR up. At the moment I am using a hardcoded cilium version, which I am not sure yet where to find it, it's not in the configmap, but it shouldn't be too hard.

This is my current state:

% cilium hubble disable
unable to retrieve helm values secret kube-system/cilium-cli-helm-values: secrets "cilium-cli-helm-values" not found
🔥 Deleting Hubble UI...
🔥 Deleting Relay...
🔥 Deleting Relay certificates...
🔥 Deleting Peer Service...
✨ Patching ConfigMap cilium-config to disable Hubble...
apiVersion: v1
kind: ConfigMap
metadata:
  name: cilium-config
....
🚀 Creating ConfigMap for Cilium version 1.12.0...
♻️  Restarted Cilium pods
✅ Hubble was successfully disabled.

% cilium hubble enable
🔑 Found CA in secret cilium-ca
ℹ️  helm template --namespace kube-system cilium cilium/cilium --version 1.12.0 --set hubble.enabled=true,hubble.relay.enabled=true,hubble.tls.ca.cert=<REDACTED>
✨ Patching ConfigMap cilium-config to enable Hubble...
apiVersion: v1
kind: ConfigMap
metadata:
  name: cilium-config
....
  # Enable Hubble gRPC service.
  enable-hubble: "true"
  # UNIX domain socket for Hubble server to listen to.
  hubble-socket-path: "/var/run/cilium/hubble.sock"
  # An additional address for Hubble server to listen to (e.g. ":4244").
  hubble-listen-address: ":4244"
  hubble-disable-tls: "false"
  hubble-tls-cert-file: /var/lib/cilium/tls/hubble/server.crt
  hubble-tls-key-file: /var/lib/cilium/tls/hubble/server.key
  hubble-tls-client-ca-files: /var/lib/cilium/tls/hubble/client-ca.crt
...
🚀 Creating ConfigMap for Cilium version 1.12.0...
♻️  Restarted Cilium pods
⌛ Waiting for Cilium to become ready before deploying other Hubble component(s)...
🚀 Creating Peer Service...
✨ Generating certificates...
🔑 Generating certificates for Relay...
✨ Deploying Relay...
⌛ Waiting for Hubble to be installed...
ℹ️  Storing helm values file in kube-system/cilium-cli-helm-values Secret
panic: runtime error: invalid memory address or nil pointer dereference

@sayboras
Copy link
Member

sayboras commented Aug 5, 2022

Thanks for your help on this, feel free to reach out in Cilium OSS #development channel if you have any questions.

olga-mir added a commit to olga-mir/cilium-cli that referenced this issue Aug 7, 2022
when cilium initially was not installed wih cilium-cli. In these cases
`cilium-cli-helm-values` secret does not exist and all `cilium hubble`
commands fail.

Since hubble components are cherry-picked from the generated helm manifests,
it should be safe to proceed without the full helm values state if we can
retrieve the cilium version running in the cluster.

We should not write the new helm state to the cluster so that if in the
future other components need to use it, we don't inadvertently
override real installation parameters.

Fixes: cilium#959

Signed-off-by: Olga Mirensky <[email protected]>
olga-mir added a commit to olga-mir/cilium-cli that referenced this issue Aug 7, 2022
… not exist

This commit fixes hubble enable and disable commands which are broken
when cilium initially was not installed with cilium-cli. In these cases
`cilium-cli-helm-values` secret does not exist and all `cilium hubble`
commands fail.

Since hubble components are cherry-picked from the generated helm manifests,
it should be safe to proceed without the full helm values state.

We should not write the new helm state to the cluster so that if in the
future other components need to use it, we don't inadvertently
over shadow real installation parameters.

Fixes: cilium#959

Signed-off-by: Olga Mirensky <[email protected]>
@ericsong86
Copy link
Contributor

@olga-mir, I have problem too, But I think if you use helm deploy into kubernetes, you shouldn't use cilium deploy hubble or should use helm. Because of cilium will store helm values in to secrets, this name is cilium-cli-helm-values. if you use helm but not create this secrets. may be this is bug. But I think the best way this is command:

helm upgrade cilium cilium/cilium --version 1.12.1 \
   --namespace kube-system \
   --reuse-values \
   --set hubble.relay.enabled=true \
   --set hubble.ui.enabled=true

hope to help you

@dreamerlzl
Copy link

dreamerlzl commented Aug 18, 2022

helm upgrade cilium cilium/cilium --version 1.12.1 \
   --namespace kube-system \
   --reuse-values \
   --set hubble.relay.enabled=true \
   --set hubble.ui.enabled=true

I follow the official guide to install cilium on kind and met a similar problem secrets "cilium-cli-helm-values" not found.
Your suggestion partially works, in that hubble shows OK in output of cilium status; but the deployment for hubble-UI and hubble-relay still failed without pods being created. No events either.

@olga-mir
Copy link
Contributor

@misstick86, I agree with you, with some remarks.

Because of cilium will store helm values in to secrets

It's up to the implementation. The draft PR that I have opened does not store the values back to the secret (which did not exist in this scenario) so it doesn't introduce any new default values that may have been set to something different at installation time. It did create inconsistency with cilium-config configmap as pointed out by the reviewers, which I have solution for but haven't pushed it to the PR yet.

I am not a maintainer, but I think that even if the issue is fixed without adding non-hubble values to the secret or the configmap, it still creates a drift in hubble related values which is not ideal. Running cilium hubble enable/disable is an out-of-band operation in this case. As you mentioned, better option is to stick with the same deployment method. But in the scope of cilium-cli, I think it depends on the cli vision - do we want to enable smooth and quick experimentation or make this flow unsupported and provide a nicer error message. I raised this concern in the development channel before, it's up to maintainers to decide.

Also note, the longer term vision for cilium cli to be a smart wrapper on helm install/upgrade as per this comment, so it'll eventually be fixed anyway: #1020 (comment)

olga-mir added a commit to olga-mir/cilium-cli that referenced this issue Sep 16, 2022
… not exist

This commit fixes hubble enable and disable commands which are broken
when cilium initially was not installed with cilium-cli. In these cases
`cilium-cli-helm-values` secret does not exist and all `cilium hubble`
commands fail.

Since hubble components are cherry-picked from the generated helm manifests,
it should be safe to proceed without the full helm values state.

We should not write the new helm state to the cluster so that if in the
future other components need to use it, we don't inadvertently
over shadow real installation parameters.

Fixes: cilium#959

Signed-off-by: Olga Mirensky <[email protected]>
tklauser pushed a commit that referenced this issue Sep 19, 2022
… not exist

This commit fixes hubble enable and disable commands which are broken
when cilium initially was not installed with cilium-cli. In these cases
`cilium-cli-helm-values` secret does not exist and all `cilium hubble`
commands fail.

Since hubble components are cherry-picked from the generated helm manifests,
it should be safe to proceed without the full helm values state.

We should not write the new helm state to the cluster so that if in the
future other components need to use it, we don't inadvertently
over shadow real installation parameters.

Fixes: #959

Signed-off-by: Olga Mirensky <[email protected]>
@ensonic
Copy link

ensonic commented Feb 15, 2023

Not fixed :/

cilium hubble disable
⚠️  Error parsing helm cli secret: unable to retrieve helm values secret kube-system/cilium-cli-helm-values: secrets "cilium-cli-helm-values" not found
⚠️  Proceeding in unknown installation state
🔮 Auto-detected cilium version v1.12.7
🔥 Deleting Hubble UI...
🔥 Deleting Relay...
🔥 Deleting Relay certificates...
🔥 Deleting Peer Service...
✨ Patching ConfigMap cilium-config to disable Hubble...
🚀 Creating ConfigMap for Cilium version 1.12.7...
♻️  Restarted Cilium pods
✅ Hubble was successfully disabled.

@benpsnyder
Copy link

Not fixed in v1.13.0 either

cilium install --version=1.13.0 --helm-auto-gen-values cilium-helm-values-install.yaml \
  --helm-set ipam.mode=cluster-pool \
  --helm-set ipam.operator.clusterPoolIPv4PodCIDRList="10.252.0.0/15" \
  --helm-set tunnel="geneve" \
  --helm-set ipv4NativeRoutingCIDR="10.252.0.0/15" \
  --helm-set bgpControlPlane.enabled=true \
  --helm-set k8s.requireIPv4PodCIDR=true \
  --helm-set device="snyderedge-p" \
  --helm-set cluster.name="snyderedge" \
  --helm-set cluster.id=1 \
  --helm-set tag="v1.13.0" \
  --helm-set kubeProxyReplacement="strict" \
  --helm-set bgpControlPlane.enabled=true \
  --helm-set k8s.requireIPv4PodCIDR=true \
  --helm-set hubble.ui.enabled=true \
  --helm-set hubble.relay.enable=true \
  --helm-set clustermesh.useAPIServer=true \
  --helm-set clustermesh.apiserver.enabled=true \
  --helm-set clustermesh.apiserver.tls.auto.method=certmanager

cilium install --version=1.13.0 --helm-values cilium-helm-values-install.yaml

Result:

~/: cilium install --version=1.13.0 --helm-values cilium-helm-values-install.yaml
🔮 Auto-detected Kubernetes kind: K3s
ℹ️  Using Cilium version 1.13.0
🔮 Auto-detected cluster name: default
🔮 Auto-detected datapath mode: tunnel
⚠️ Unable to list kubernetes api resources, try --api-versions if needed: %!w(*fmt.wrapError=&{failed to list api resources: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request 0x14000da8140})
ℹ️  helm template --namespace kube-system cilium cilium/cilium --version 1.13.0 --set bgpControlPlane.enabled=true,bpf.masquerade=true,cluster.id=1,cluster.name=snyderedge,clustermesh.apiserver.enabled=true,clustermesh.apiserver.tls.auto.method=certmanager,clustermesh.useAPIServer=true,device=snyderedge-p,encryption.nodeEncryption=false,hubble.relay.enable=true,hubble.ui.enabled=true,ipam.mode=cluster-pool,ipam.operator.clusterPoolIPv4PodCIDRList=10.252.0.0/15,ipv4NativeRoutingCIDR=10.252.0.0/15,k8s.requireIPv4PodCIDR=true,kubeProxyReplacement=strict,operator.replicas=1,serviceAccounts.cilium.name=cilium,serviceAccounts.operator.name=cilium-operator,tag=v1.13.0,tunnel=geneve
↩️ Rolling back installation...

Error: Unable to install Cilium: execution error at (cilium/templates/validate.yaml:4:7): Hubble UI requires .Values.hubble.relay.enabled=true

@olga-mir
Copy link
Contributor

Hi @ensonic the output you posted shows that the feature actually worked ✅ Hubble was successfully disabled. despite the secret not being present: Proceeding in unknown installation state.

But thanks for bringing this up to my attention, I can see how it might be confusing for the end user.

@olga-mir
Copy link
Contributor

@benpsnyder I don't think this error is related to cilium-cli. The output shows unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request which I don't believe has anything to do with the content of the fixing PR.

Also please note that for the purpose of this bug what important is version of the cilium-cli, not necessarily the cilium installation itself. If you have further queries can you please post output of cilium version as well?

aditighag pushed a commit to aditighag/cilium-cli that referenced this issue Apr 21, 2023
… not exist

This commit fixes hubble enable and disable commands which are broken
when cilium initially was not installed with cilium-cli. In these cases
`cilium-cli-helm-values` secret does not exist and all `cilium hubble`
commands fail.

Since hubble components are cherry-picked from the generated helm manifests,
it should be safe to proceed without the full helm values state.

We should not write the new helm state to the cluster so that if in the
future other components need to use it, we don't inadvertently
over shadow real installation parameters.

Fixes: cilium#959

Signed-off-by: Olga Mirensky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind/bug Something isn't working kind/community-report This was reported by a user in the Cilium community, eg via Slack.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants