Troubleshooting

This document describes how to troubleshoot Cilium in different deployment modes. It focuses on a full deployment of Cilium within a datacenter or public cloud. If you are just looking for a simple way to experiment, we highly recommend trying out the Getting Started Guides instead.

This guide assumes that you have read the Concepts which explains all the components and concepts.

We use GitHub issues to maintain a list of Cilium Frequently Asked Questions (FAQ). You can also check there to see if your question(s) is already addressed.

Component & Cluster Health

Kubernetes

An initial overview of Cilium can be retrieved by listing all pods to verify whether all pods have the status Running:

  1. $ kubectl -n kube-system get pods -l k8s-app=cilium
  2. NAME READY STATUS RESTARTS AGE
  3. cilium-2hq5z 1/1 Running 0 4d
  4. cilium-6kbtz 1/1 Running 0 4d
  5. cilium-klj4b 1/1 Running 0 4d
  6. cilium-zmjj9 1/1 Running 0 4d

If Cilium encounters a problem that it cannot recover from, it will automatically report the failure state via cilium status which is regularly queried by the Kubernetes liveness probe to automatically restart Cilium pods. If a Cilium pod is in state CrashLoopBackoff then this indicates a permanent failure scenario.

Detailed Status

If a particular Cilium pod is not in running state, the status and health of the agent on that node can be retrieved by running cilium status in the context of that pod:

  1. $ kubectl -n kube-system exec cilium-2hq5z -- cilium status
  2. KVStore: Ok etcd: 1/1 connected: http://demo-etcd-lab--a.etcd.tgraf.test1.lab.corp.isovalent.link:2379 - 3.2.5 (Leader)
  3. ContainerRuntime: Ok docker daemon: OK
  4. Kubernetes: Ok OK
  5. Kubernetes APIs: ["cilium/v2::CiliumNetworkPolicy", "networking.k8s.io/v1::NetworkPolicy", "core/v1::Service", "core/v1::Endpoint", "core/v1::Node", "CustomResourceDefinition"]
  6. Cilium: Ok OK
  7. NodeMonitor: Disabled
  8. Cilium health daemon: Ok
  9. Controller Status: 14/14 healthy
  10. Proxy Status: OK, ip 10.2.0.172, port-range 10000-20000
  11. Cluster health: 4/4 reachable (2018-06-16T09:49:58Z)

Alternatively, the k8s-cilium-exec.sh script can be used to run cilium status on all nodes. This will provide detailed status and health information of all nodes in the cluster:

  1. curl -sLO https://raw.githubusercontent.com/cilium/cilium/master/contrib/k8s/k8s-cilium-exec.sh
  2. chmod +x ./k8s-cilium-exec.sh

… and run cilium status on all nodes:

  1. $ ./k8s-cilium-exec.sh cilium status
  2. KVStore: Ok Etcd: http://127.0.0.1:2379 - (Leader) 3.1.10
  3. ContainerRuntime: Ok
  4. Kubernetes: Ok OK
  5. Kubernetes APIs: ["extensions/v1beta1::Ingress", "core/v1::Node", "CustomResourceDefinition", "cilium/v2::CiliumNetworkPolicy", "networking.k8s.io/v1::NetworkPolicy", "core/v1::Service", "core/v1::Endpoint"]
  6. Cilium: Ok OK
  7. NodeMonitor: Listening for events on 2 CPUs with 64x4096 of shared memory
  8. Cilium health daemon: Ok
  9. Controller Status: 7/7 healthy
  10. Proxy Status: OK, ip 10.15.28.238, 0 redirects, port-range 10000-20000
  11. Cluster health: 1/1 reachable (2018-02-27T00:24:34Z)

Detailed information about the status of Cilium can be inspected with the cilium status --verbose command. Verbose output includes detailed IPAM state (allocated addresses), Cilium controller status, and details of the Proxy status.

Logs

To retrieve log files of a cilium pod, run (replace cilium-1234 with a pod name returned by kubectl -n kube-system get pods -l k8s-app=cilium)

  1. kubectl -n kube-system logs --timestamps cilium-1234

If the cilium pod was already restarted due to the liveness problem after encountering an issue, it can be useful to retrieve the logs of the pod before the last restart:

  1. kubectl -n kube-system logs --timestamps -p cilium-1234

Generic

When logged in a host running Cilium, the cilium CLI can be invoked directly, e.g.:

  1. $ cilium status
  2. KVStore: Ok etcd: 1/1 connected: https://192.168.60.11:2379 - 3.2.7 (Leader)
  3. ContainerRuntime: Ok
  4. Kubernetes: Ok OK
  5. Kubernetes APIs: ["core/v1::Endpoint", "extensions/v1beta1::Ingress", "core/v1::Node", "CustomResourceDefinition", "cilium/v2::CiliumNetworkPolicy", "networking.k8s.io/v1::NetworkPolicy", "core/v1::Service"]
  6. Cilium: Ok OK
  7. NodeMonitor: Listening for events on 2 CPUs with 64x4096 of shared memory
  8. Cilium health daemon: Ok
  9. IPv4 address pool: 261/65535 allocated
  10. IPv6 address pool: 4/4294967295 allocated
  11. Controller Status: 20/20 healthy
  12. Proxy Status: OK, ip 10.0.28.238, port-range 10000-20000
  13. Hubble: Ok Current/Max Flows: 2542/4096 (62.06%), Flows/s: 164.21 Metrics: Disabled
  14. Cluster health: 2/2 reachable (2018-04-11T15:41:01Z)

Observing Flows with Hubble

Hubble is a built-in observability tool which allows you to inspect recent flow events on all endpoints managed by Cilium.

Ensure Hubble is running correctly

To ensure the Hubble client can connect to the Hubble server running inside Cilium, you may use the hubble status command from within a Cilium pod:

  1. $ hubble status
  2. Healthcheck (via unix:///var/run/cilium/hubble.sock): Ok
  3. Current/Max Flows: 4095/4095 (100.00%)
  4. Flows/s: 164.21

cilium-agent must be running with the --enable-hubble option (default) in order for the Hubble server to be enabled. When deploying Cilium with Helm, make sure to set the hubble.enabled=true value.

To check if Hubble is enabled in your deployment, you may look for the following output in cilium status:

  1. $ cilium status
  2. ...
  3. Hubble: Ok Current/Max Flows: 4095/4095 (100.00%), Flows/s: 164.21 Metrics: Disabled
  4. ...

Note

Pods need to be managed by Cilium in order to be observable by Hubble. See how to ensure a pod is managed by Cilium for more details.

Observing flows of a specific pod

In order to observe the traffic of a specific pod, you will first have to retrieve the name of the cilium instance managing it. The Hubble CLI is part of the Cilium container image and can be accessed via kubectl exec. The following query for example will show all events related to flows which either originated or terminated in the default/tiefighter pod in the last three minutes:

  1. $ kubectl exec -n kube-system cilium-77lk6 -- hubble observe --since 3m --pod default/tiefighter
  2. May 4 12:47:08.811: default/tiefighter:53875 -> kube-system/coredns-74ff55c5b-66f4n:53 to-endpoint FORWARDED (UDP)
  3. May 4 12:47:08.811: default/tiefighter:53875 -> kube-system/coredns-74ff55c5b-66f4n:53 to-endpoint FORWARDED (UDP)
  4. May 4 12:47:08.811: default/tiefighter:53875 <- kube-system/coredns-74ff55c5b-66f4n:53 to-endpoint FORWARDED (UDP)
  5. May 4 12:47:08.811: default/tiefighter:53875 <- kube-system/coredns-74ff55c5b-66f4n:53 to-endpoint FORWARDED (UDP)
  6. May 4 12:47:08.811: default/tiefighter:50214 <> default/deathstar-c74d84667-cx5kp:80 to-overlay FORWARDED (TCP Flags: SYN)
  7. May 4 12:47:08.812: default/tiefighter:50214 <- default/deathstar-c74d84667-cx5kp:80 to-endpoint FORWARDED (TCP Flags: SYN, ACK)
  8. May 4 12:47:08.812: default/tiefighter:50214 <> default/deathstar-c74d84667-cx5kp:80 to-overlay FORWARDED (TCP Flags: ACK)
  9. May 4 12:47:08.812: default/tiefighter:50214 <> default/deathstar-c74d84667-cx5kp:80 to-overlay FORWARDED (TCP Flags: ACK, PSH)
  10. May 4 12:47:08.812: default/tiefighter:50214 <- default/deathstar-c74d84667-cx5kp:80 to-endpoint FORWARDED (TCP Flags: ACK, PSH)
  11. May 4 12:47:08.812: default/tiefighter:50214 <> default/deathstar-c74d84667-cx5kp:80 to-overlay FORWARDED (TCP Flags: ACK, FIN)
  12. May 4 12:47:08.812: default/tiefighter:50214 <- default/deathstar-c74d84667-cx5kp:80 to-endpoint FORWARDED (TCP Flags: ACK, FIN)
  13. May 4 12:47:08.812: default/tiefighter:50214 <> default/deathstar-c74d84667-cx5kp:80 to-overlay FORWARDED (TCP Flags: ACK)

You may also use -o json to obtain more detailed information about each flow event.

Note

Hubble Relay allows you to query multiple Hubble instances simultaneously without having to first manually target a specific node. See Observing flows with Hubble Relay for more information.

Observing flows with Hubble Relay

Hubble Relay is a service which allows to query multiple Hubble instances simultaneously and aggregate the results. See Setting up Hubble Observability to enable Hubble Relay if it is not yet enabled and install the Hubble CLI on your local machine.

You may access the Hubble Relay service by port-forwarding it locally:

  1. kubectl -n kube-system port-forward service/hubble-relay --address 0.0.0.0 --address :: 4245:80

This will forward the Hubble Relay service port (80) to your local machine on port 4245 on all of it’s IP addresses.

You can verify that Hubble Relay can be reached by using the Hubble CLI and running the following command from your local machine:

  1. hubble status

This command should return an output similar to the following:

  1. Healthcheck (via localhost:4245): Ok
  2. Current/Max Flows: 16380/16380 (100.00%)
  3. Flows/s: 46.19
  4. Connected Nodes: 4/4

You may see details about nodes that Hubble Relay is connected to by running the following command:

  1. hubble list nodes

As Hubble Relay shares the same API as individual Hubble instances, you may follow the Observing flows with Hubble section keeping in mind that limitations with regards to what can be seen from individual Hubble instances no longer apply.

Connectivity Problems

Cilium connectivity tests

The Cilium connectivity test deploys a series of services, deployments, and CiliumNetworkPolicy which will use various connectivity paths to connect to each other. Connectivity paths include with and without service load-balancing and various network policy combinations.

Note

The connectivity tests this will only work in a namespace with no other pods or network policies applied. If there is a Cilium Clusterwide Network Policy enabled, that may also break this connectivity check.

To run the connectivity tests create an isolated test namespace called cilium-test to deploy the tests with.

  1. kubectl create ns cilium-test
  2. kubectl apply --namespace=cilium-test -f https://raw.githubusercontent.com/cilium/cilium/v1.12/examples/kubernetes/connectivity-check/connectivity-check.yaml

The tests cover various functionality of the system. Below we call out each test type. If tests pass, it suggests functionality of the referenced subsystem.

Pod-to-pod (intra-host)

Pod-to-pod (inter-host)

Pod-to-service (intra-host)

Pod-to-service (inter-host)

Pod-to-external resource

eBPF routing is functional

Data plane, routing, network

eBPF service map lookup

VXLAN overlay port if used

Egress, CiliumNetworkPolicy, masquerade

The pod name indicates the connectivity variant and the readiness and liveness gate indicates success or failure of the test:

  1. $ kubectl get pods -n cilium-test
  2. NAME READY STATUS RESTARTS AGE
  3. echo-a-6788c799fd-42qxx 1/1 Running 0 69s
  4. echo-b-59757679d4-pjtdl 1/1 Running 0 69s
  5. echo-b-host-f86bd784d-wnh4v 1/1 Running 0 68s
  6. host-to-b-multi-node-clusterip-585db65b4d-x74nz 1/1 Running 0 68s
  7. host-to-b-multi-node-headless-77c64bc7d8-kgf8p 1/1 Running 0 67s
  8. pod-to-a-allowed-cnp-87b5895c8-bfw4x 1/1 Running 0 68s
  9. pod-to-a-b76ddb6b4-2v4kb 1/1 Running 0 68s
  10. pod-to-a-denied-cnp-677d9f567b-kkjp4 1/1 Running 0 68s
  11. pod-to-b-intra-node-nodeport-8484fb6d89-bwj8q 1/1 Running 0 68s
  12. pod-to-b-multi-node-clusterip-f7655dbc8-h5bwk 1/1 Running 0 68s
  13. pod-to-b-multi-node-headless-5fd98b9648-5bjj8 1/1 Running 0 68s
  14. pod-to-b-multi-node-nodeport-74bd8d7bd5-kmfmm 1/1 Running 0 68s
  15. pod-to-external-1111-7489c7c46d-jhtkr 1/1 Running 0 68s
  16. pod-to-external-fqdn-allow-google-cnp-b7b6bcdcb-97p75 1/1 Running 0 68s

Information about test failures can be determined by describing a failed test pod

  1. $ kubectl describe pod pod-to-b-intra-node-hostport
  2. Warning Unhealthy 6s (x6 over 56s) kubelet, agent1 Readiness probe failed: curl: (7) Failed to connect to echo-b-host-headless port 40000: Connection refused
  3. Warning Unhealthy 2s (x3 over 52s) kubelet, agent1 Liveness probe failed: curl: (7) Failed to connect to echo-b-host-headless port 40000: Connection refused

Checking cluster connectivity health

Cilium can rule out network fabric related issues when troubleshooting connectivity issues by providing reliable health and latency probes between all cluster nodes and a simulated workload running on each node.

By default when Cilium is run, it launches instances of cilium-health in the background to determine the overall connectivity status of the cluster. This tool periodically runs bidirectional traffic across multiple paths through the cluster and through each node using different protocols to determine the health status of each path and protocol. At any point in time, cilium-health may be queried for the connectivity status of the last probe.

  1. $ kubectl -n kube-system exec -ti cilium-2hq5z -- cilium-health status
  2. Probe time: 2018-06-16T09:51:58Z
  3. Nodes:
  4. ip-172-0-52-116.us-west-2.compute.internal (localhost):
  5. Host connectivity to 172.0.52.116:
  6. ICMP to stack: OK, RTT=315.254µs
  7. HTTP to agent: OK, RTT=368.579µs
  8. Endpoint connectivity to 10.2.0.183:
  9. ICMP to stack: OK, RTT=190.658µs
  10. HTTP to agent: OK, RTT=536.665µs
  11. ip-172-0-117-198.us-west-2.compute.internal:
  12. Host connectivity to 172.0.117.198:
  13. ICMP to stack: OK, RTT=1.009679ms
  14. HTTP to agent: OK, RTT=1.808628ms
  15. Endpoint connectivity to 10.2.1.234:
  16. ICMP to stack: OK, RTT=1.016365ms
  17. HTTP to agent: OK, RTT=2.29877ms

For each node, the connectivity will be displayed for each protocol and path, both to the node itself and to an endpoint on that node. The latency specified is a snapshot at the last time a probe was run, which is typically once per minute. The ICMP connectivity row represents Layer 3 connectivity to the networking stack, while the HTTP connectivity row represents connection to an instance of the cilium-health agent running on the host or as an endpoint.

Monitoring Datapath State

Sometimes you may experience broken connectivity, which may be due to a number of different causes. A main cause can be unwanted packet drops on the networking level. The tool cilium monitor allows you to quickly inspect and see if and where packet drops happen. Following is an example output (use kubectl exec as in previous examples if running with Kubernetes):

  1. $ kubectl -n kube-system exec -ti cilium-2hq5z -- cilium monitor --type drop
  2. Listening for events on 2 CPUs with 64x4096 of shared memory
  3. Press Ctrl-C to quit
  4. xx drop (Policy denied) to endpoint 25729, identity 261->264: fd02::c0a8:210b:0:bf00 -> fd02::c0a8:210b:0:6481 EchoRequest
  5. xx drop (Policy denied) to endpoint 25729, identity 261->264: fd02::c0a8:210b:0:bf00 -> fd02::c0a8:210b:0:6481 EchoRequest
  6. xx drop (Policy denied) to endpoint 25729, identity 261->264: 10.11.13.37 -> 10.11.101.61 EchoRequest
  7. xx drop (Policy denied) to endpoint 25729, identity 261->264: 10.11.13.37 -> 10.11.101.61 EchoRequest
  8. xx drop (Invalid destination mac) to endpoint 0, identity 0->0: fe80::5c25:ddff:fe8e:78d8 -> ff02::2 RouterSolicitation

The above indicates that a packet to endpoint ID 25729 has been dropped due to violation of the Layer 3 policy.

Handling drop (CT: Map insertion failed)

If connectivity fails and cilium monitor --type drop shows xx drop (CT: Map insertion failed), then it is likely that the connection tracking table is filling up and the automatic adjustment of the garbage collector interval is insufficient. Set --conntrack-gc-interval to an interval lower than the default. The default starting interval is 5 minutes. Alternatively, the value for bpf-ct-global-any-max and bpf-ct-global-tcp-max can be increased. Setting both of these options will be a trade-off of CPU for conntrack-gc-interval, and for bpf-ct-global-any-max and bpf-ct-global-tcp-max the amount of memory consumed.

Enabling datapath debug messages

By default, datapath debug messages are disabled, and therefore not shown in cilium monitor -v output. To enable them, add "datapath" to the debug-verbose option.

Policy Troubleshooting

Ensure pod is managed by Cilium

A potential cause for policy enforcement not functioning as expected is that the networking of the pod selected by the policy is not being managed by Cilium. The following situations result in unmanaged pods:

  • The pod is running in host networking and will use the host’s IP address directly. Such pods have full network connectivity but Cilium will not provide security policy enforcement for such pods by default. To enforce policy against these pods, either set hostNetwork to false or use Host Policies.

  • The pod was started before Cilium was deployed. Cilium only manages pods that have been deployed after Cilium itself was started. Cilium will not provide security policy enforcement for such pods. These pods should be restarted in order to ensure that Cilium can provide security policy enforcement.

If pod networking is not managed by Cilium. Ingress and egress policy rules selecting the respective pods will not be applied. See the section Network Policy for more details.

For a quick assessment of whether any pods are not managed by Cilium, the Cilium CLI will print the number of managed pods. If this prints that all of the pods are managed by Cilium, then there is no problem:

  1. $ cilium status
  2. /¯¯\
  3. /¯¯\__/¯¯\ Cilium: OK
  4. \__/¯¯\__/ Operator: OK
  5. /¯¯\__/¯¯\ Hubble: OK
  6. \__/¯¯\__/ ClusterMesh: disabled
  7. \__/
  8. Deployment cilium-operator Desired: 2, Ready: 2/2, Available: 2/2
  9. Deployment hubble-relay Desired: 1, Ready: 1/1, Available: 1/1
  10. Deployment hubble-ui Desired: 1, Ready: 1/1, Available: 1/1
  11. DaemonSet cilium Desired: 2, Ready: 2/2, Available: 2/2
  12. Containers: cilium-operator Running: 2
  13. hubble-relay Running: 1
  14. hubble-ui Running: 1
  15. cilium Running: 2
  16. Cluster Pods: 5/5 managed by Cilium
  17. ...

You can run the following script to list the pods which are not managed by Cilium:

  1. $ curl -sLO https://raw.githubusercontent.com/cilium/cilium/master/contrib/k8s/k8s-unmanaged.sh
  2. $ chmod +x k8s-unmanaged.sh
  3. $ ./k8s-unmanaged.sh
  4. kube-system/cilium-hqpk7
  5. kube-system/kube-addon-manager-minikube
  6. kube-system/kube-dns-54cccfbdf8-zmv2c
  7. kube-system/kubernetes-dashboard-77d8b98585-g52k5
  8. kube-system/storage-provisioner

Understand the rendering of your policy

There are always multiple ways to approach a problem. Cilium can provide the rendering of the aggregate policy provided to it, leaving you to simply compare with what you expect the policy to actually be rather than search (and potentially overlook) every policy. At the expense of reading a very large dump of an endpoint, this is often a faster path to discovering errant policy requests in the Kubernetes API.

Start by finding the endpoint you are debugging from the following list. There are several cross references for you to use in this list, including the IP address and pod labels:

  1. kubectl -n kube-system exec -ti cilium-q8wvt -- cilium endpoint list

When you find the correct endpoint, the first column of every row is the endpoint ID. Use that to dump the full endpoint information:

  1. kubectl -n kube-system exec -ti cilium-q8wvt -- cilium endpoint get 59084

../../_images/troubleshooting_policy.png

Importing this dump into a JSON-friendly editor can help browse and navigate the information here. At the top level of the dump, there are two nodes of note:

  • spec: The desired state of the endpoint

  • status: The current state of the endpoint

This is the standard Kubernetes control loop pattern. Cilium is the controller here, and it is iteratively working to bring the status in line with the spec.

Opening the status, we can drill down through policy.realized.l4. Do your ingress and egress rules match what you expect? If not, the reference to the errant rules can be found in the derived-from-rules node.

etcd (kvstore)

Introduction

Cilium can be operated in CRD-mode and kvstore/etcd mode. When cilium is running in kvstore/etcd mode, the kvstore becomes a vital component of the overall cluster health as it is required to be available for several operations.

Operations for which the kvstore is strictly required when running in etcd mode:

Scheduling of new workloads:

As part of scheduling workloads/endpoints, agents will perform security identity allocation which requires interaction with the kvstore. If a workload can be scheduled due to re-using a known security identity, then state propagation of the endpoint details to other nodes will still depend on the kvstore and thus packets drops due to policy enforcement may be observed as other nodes in the cluster will not be aware of the new workload.

Multi cluster:

All state propagation between clusters depends on the kvstore.

Node discovery:

New nodes require to register themselves in the kvstore.

Agent bootstrap:

The Cilium agent will eventually fail if it can’t connect to the kvstore at bootstrap time, however, the agent will still perform all possible operations while waiting for the kvstore to appear.

Operations which do not require kvstore availability:

All datapath operations:

All datapath forwarding, policy enforcement and visibility functions for existing workloads/endpoints do not depend on the kvstore. Packets will continue to be forwarded and network policy rules will continue to be enforced.

However, if the agent requires to restart as part of the Recovery behavior, there can be delays in:

  • processing of flow events and metrics

  • short unavailability of layer 7 proxies

NetworkPolicy updates:

Network policy updates will continue to be processed and applied.

Services updates:

All updates to services will be processed and applied.

Understanding etcd status

The etcd status is reported when running cilium status. The following line represents the status of etcd:

  1. KVStore: Ok etcd: 1/1 connected, lease-ID=29c6732d5d580cb5, lock lease-ID=29c6732d5d580cb7, has-quorum=true: https://192.168.60.11:2379 - 3.4.9 (Leader)

OK:

The overall status. Either OK or Failure.

1/1 connected:

Number of total etcd endpoints and how many of them are reachable.

lease-ID:

UUID of the lease used for all keys owned by this agent.

lock lease-ID:

UUID of the lease used for locks acquired by this agent.

has-quorum:

Status of etcd quorum. Either true or set to an error.

consecutive-errors:

Number of consecutive quorum errors. Only printed if errors are present.

https://192.168.60.11:2379 - 3.4.9 (Leader):

List of all etcd endpoints stating the etcd version and whether the particular endpoint is currently the elected leader. If an etcd endpoint cannot be reached, the error is shown.

Recovery behavior

In the event of an etcd endpoint becoming unhealthy, etcd should automatically resolve this by electing a new leader and by failing over to a healthy etcd endpoint. As long as quorum is preserved, the etcd cluster will remain functional.

In addition, Cilium performs a background check in an interval to determine etcd health and potentially take action. The interval depends on the overall cluster size. The larger the cluster, the longer the interval:

  • If no etcd endpoints can be reached, Cilium will report failure in cilium status. This will cause the liveness and readiness probe of Kubernetes to fail and Cilium will be restarted.

  • A lock is acquired and released to test a write operation which requires quorum. If this operation fails, loss of quorum is reported. If quorum fails for three or more intervals in a row, Cilium is declared unhealthy.

  • The Cilium operator will constantly write to a heartbeat key (cilium/.heartbeat). All Cilium agents will watch for updates to this heartbeat key. This validates the ability for an agent to receive key updates from etcd. If the heartbeat key is not updated in time, the quorum check is declared to have failed and Cilium is declared unhealthy after 3 or more consecutive failures.

Example of a status with a quorum failure which has not yet reached the threshold:

  1. KVStore: Ok etcd: 1/1 connected, lease-ID=29c6732d5d580cb5, lock lease-ID=29c6732d5d580cb7, has-quorum=2m2.778966915s since last heartbeat update has been received, consecutive-errors=1: https://192.168.60.11:2379 - 3.4.9 (Leader)

Example of a status with the number of quorum failures exceeding the threshold:

  1. KVStore: Failure Err: quorum check failed 8 times in a row: 4m28.446600949s since last heartbeat update has been received

Cluster Mesh Troubleshooting

Install the Cilium CLI

Install the latest version of the Cilium CLI. The Cilium CLI can be used to install Cilium, inspect the state of a Cilium installation, and enable/disable various features (e.g. clustermesh, Hubble).

LinuxmacOSOther

  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "arm64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. shasum -a 256 -c cilium-darwin-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-darwin-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}

See the full page of releases.

Generic

  1. Validate that the cilium-xxx as well as the cilium-operator-xxx pods are healthy and ready.

    1. cilium status
  2. Validate the Cluster Mesh is enabled correctly and operational:

    1. cilium clustermesh status

Manual Verification of Setup

  1. Validate that the ClusterMesh subsystem is initialized by looking for a cilium-agent log message like this:

    1. level=info msg="Initializing ClusterMesh routing" path=/var/lib/cilium/clustermesh/ subsys=daemon
  2. Validate that the configuration for remote clusters is picked up correctly. For each remote cluster, an info log message New remote cluster configuration along with the remote cluster name must be logged in the cilium-agent logs.

    If the configuration is not found, check the following:

    • The Kubernetes secret clustermesh-secrets is imported correctly.

    • The secret contains a file for each remote cluster with the filename matching the name of the remote cluster.

    • The contents of the file in the secret is a valid etcd configuration consisting of the IP to reach the remote etcd as well as the required certificates to connect to that etcd.

    • Run a kubectl exec -ti [...] -- bash in one of the Cilium pods and check the contents of the directory /var/lib/cilium/clustermesh/. It must contain a configuration file for each remote cluster along with all the required SSL certificates and keys. The filenames must match the cluster names as provided by the --cluster-name argument or cluster-name ConfigMap option. If the directory is empty or incomplete, regenerate the secret again and ensure that the secret is correctly mounted into the DaemonSet.

  3. Validate that the connection to the remote cluster could be established. You will see a log message like this in the cilium-agent logs for each remote cluster:

    1. level=info msg="Connection to remote cluster established"

    If the connection failed, you will see a warning like this:

    1. level=warning msg="Unable to establish etcd connection to remote cluster"

    If the connection fails, check the following:

    • Validate that the hostAliases section in the Cilium DaemonSet maps each remote cluster to the IP of the LoadBalancer that makes the remote control plane available.

    • Validate that a local node in the source cluster can reach the IP specified in the hostAliases section. The clustermesh-secrets secret contains a configuration file for each remote cluster, it will point to a logical name representing the remote cluster:

      1. endpoints:
      2. - https://cluster1.mesh.cilium.io:2379

      The name will NOT be resolvable via DNS outside of the cilium pod. The name is mapped to an IP using hostAliases. Run kubectl -n kube-system get ds cilium -o yaml and grep for the FQDN to retrieve the IP that is configured. Then use curl to validate that the port is reachable.

    • A firewall between the local cluster and the remote cluster may drop the control plane connection. Ensure that port 2379/TCP is allowed.

State Propagation

  1. Run cilium node list in one of the Cilium pods and validate that it lists both local nodes and nodes from remote clusters. If this discovery does not work, validate the following:

    • In each cluster, check that the kvstore contains information about local nodes by running:

      1. cilium kvstore get --recursive cilium/state/nodes/v1/

      Note

      The kvstore will only contain nodes of the local cluster. It will not contain nodes of remote clusters. The state in the kvstore is used for other clusters to discover all nodes so it is important that local nodes are listed.

  2. Validate the connectivity health matrix across clusters by running cilium-health status inside any Cilium pod. It will list the status of the connectivity health check to each remote node.

    If this fails:

    • Make sure that the network allows the health checking traffic as specified in the section Firewall Rules.
  3. Validate that identities are synchronized correctly by running cilium identity list in one of the Cilium pods. It must list identities from all clusters. You can determine what cluster an identity belongs to by looking at the label io.cilium.k8s.policy.cluster.

    If this fails:

    • Is the identity information available in the kvstore of each cluster? You can confirm this by running cilium kvstore get --recursive cilium/state/identities/v1/.

      Note

      The kvstore will only contain identities of the local cluster. It will not contain identities of remote clusters. The state in the kvstore is used for other clusters to discover all identities so it is important that local identities are listed.

  4. Validate that the IP cache is synchronized correctly by running cilium bpf ipcache list or cilium map get cilium_ipcache. The output must contain pod IPs from local and remote clusters.

    If this fails:

    • Is the IP cache information available in the kvstore of each cluster? You can confirm this by running cilium kvstore get --recursive cilium/state/ip/v1/.

      Note

      The kvstore will only contain IPs of the local cluster. It will not contain IPs of remote clusters. The state in the kvstore is used for other clusters to discover all pod IPs so it is important that local identities are listed.

  5. When using global services, ensure that global services are configured with endpoints from all clusters. Run cilium service list in any Cilium pod and validate that the backend IPs consist of pod IPs from all clusters running relevant backends. You can further validate the correct datapath plumbing by running cilium bpf lb list to inspect the state of the eBPF maps.

    If this fails:

    • Are services available in the kvstore of each cluster? You can confirm this by running cilium kvstore get --recursive cilium/state/services/v1/.

    • Run cilium debuginfo and look for the section k8s-service-cache. In that section, you will find the contents of the service correlation cache. It will list the Kubernetes services and endpoints of the local cluster. It will also have a section externalEndpoints which must list all endpoints of remote clusters.

      1. #### k8s-service-cache
      2. (*k8s.ServiceCache)(0xc00000c500)({
      3. [...]
      4. services: (map[k8s.ServiceID]*k8s.Service) (len=2) {
      5. (k8s.ServiceID) default/kubernetes: (*k8s.Service)(0xc000cd11d0)(frontend:172.20.0.1/ports=[https]/selector=map[]),
      6. (k8s.ServiceID) kube-system/kube-dns: (*k8s.Service)(0xc000cd1220)(frontend:172.20.0.10/ports=[metrics dns dns-tcp]/selector=map[k8s-app:kube-dns])
      7. },
      8. endpoints: (map[k8s.ServiceID]*k8s.Endpoints) (len=2) {
      9. (k8s.ServiceID) kube-system/kube-dns: (*k8s.Endpoints)(0xc0000103c0)(10.16.127.105:53/TCP,10.16.127.105:53/UDP,10.16.127.105:9153/TCP),
      10. (k8s.ServiceID) default/kubernetes: (*k8s.Endpoints)(0xc0000103f8)(192.168.60.11:6443/TCP)
      11. },
      12. externalEndpoints: (map[k8s.ServiceID]k8s.externalEndpoints) {
      13. }
      14. })

      The sections services and endpoints represent the services of the local cluster, the section externalEndpoints lists all remote services and will be correlated with services matching the same ServiceID.

Service Mesh Troubleshooting

Install the Cilium CLI

Install the latest version of the Cilium CLI. The Cilium CLI can be used to install Cilium, inspect the state of a Cilium installation, and enable/disable various features (e.g. clustermesh, Hubble).

LinuxmacOSOther

  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "arm64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. shasum -a 256 -c cilium-darwin-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-darwin-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}

See the full page of releases.

Generic

  1. Validate that the ds/cilium as well as the deployment/cilium-operator pods are healthy and ready.

    1. $ cilium status

Manual Verification of Setup

  1. Validate that the kubeProxyReplacement is set to either partial or strict.

    1. $ kubectl exec -n kube-system ds/cilium -- cilium status
    2. ...
    3. KVStore: Ok Disabled
    4. Kubernetes: Ok 1.23 (v1.23.6) [linux/amd64]
    5. KubeProxyReplacement: Strict [eth0 192.168.49.2]
  2. Validate that runtime the values of enable-envoy-config and enable-ingress-controller are true. Ingress controller flag is optional if customer only uses CiliumEnvoyConfig or CiliumClusterwideEnvoyConfig CRDs.

    1. $ kubectl -n kube-system get cm cilium-config -o json | egrep "enable-ingress-controller|enable-envoy-config"
    2. "enable-envoy-config": "true",
    3. "enable-ingress-controller": "true",

Ingress Troubleshooting

Internally, the Cilium Ingress controller will create one Load Balancer service, one CiliumEnvoyConfig and one dummy Endpoint resource for each Ingress resource.

  1. $ kubectl get ingress
  2. NAME CLASS HOSTS ADDRESS PORTS AGE
  3. basic-ingress cilium * 10.97.60.117 80 16m
  4. $ kubectl get service cilium-ingress-basic-ingress
  5. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  6. cilium-ingress-basic-ingress LoadBalancer 10.97.60.117 10.97.60.117 80:31911/TCP 17m
  7. $ kubectl get cec cilium-ingress-default-basic-ingress
  8. NAME AGE
  9. cilium-ingress-default-basic-ingress 18m
  1. Validate that the Load Balancer service has either an external IP or FQDN assigned. If it’s not available after a long time, please check the Load Balancer related documentation from your respective cloud provider.

  2. Check if there is any warning or error message while Cilium is trying to provision the CiliumEnvoyConfig resource. This is unlikely to happen for CEC resources originating from the Cilium Ingress controller.

    Note

    Note that these Envoy resources are not validated by K8s at all, so any errors in the Envoy resources will only be seen by the Cilium Agent observing these CRDs. This means that kubectl apply will report success, while parsing and/or installing the resources for the node-local Envoy instance may have failed. Currently the only way of verifying this is by observing Cilium Agent logs for errors and warnings. Additionally, Cilium Agent will print warning logs for any conflicting Envoy resources in the cluster.

    Note

    Note that Cilium Ingress Controller will configure required Envoy resource under the hood. Please check Cilium Agent logs if you are creating Envoy resources explicitly to make sure there is no conflict.

Connectivity Troubleshooting

This section is for troubleshooting connectivity issues mainly for Ingress resources, but the same steps can be applied to manually configured CiliumEnvoyConfig resources as well.

It’s best to have debug and debug-verbose enabled with below values. Kindly note that any change of Cilium flags requires a restart of the Cilium agent and operator.

  1. $ kubectl get -n kube-system cm cilium-config -o json | grep "debug"
  2. "debug": "true",
  3. "debug-verbose": "flow",

Note

The Ingress traffic is always allowed to pass through Cilium, regardless of the related CiliumNetworkPolicy for underlying pods or endpoints.

The request normally traverses from LoadBalancer service to pre-assigned port of your node, then gets forwarded to the Cilium Envoy proxy, and finally gets proxied to the actual backend service.

  1. The first step between cloud Load Balancer to node port is out of Cilium scope. Please check related documentation from your respective cloud provider to make sure your clusters are configured properly.

  2. The second step could be checked by connecting with SSH to your underlying host, and sending the similar request to localhost on the relevant port:

    1. $ kubectl get service cilium-ingress-basic-ingress
    2. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    3. cilium-ingress-basic-ingress LoadBalancer 10.97.60.117 10.97.60.117 80:31911/TCP 17m
    4. # After ssh to any of k8s node
    5. $ curl -v http://localhost:31911/
    6. * Trying 127.0.0.1:31911...
    7. * TCP_NODELAY set
    8. * Connected to localhost (127.0.0.1) port 31911 (#0)
    9. > GET / HTTP/1.1
    10. > Host: localhost:31911
    11. > User-Agent: curl/7.68.0
    12. > Accept: */*
    13. >
    14. * Mark bundle as not supporting multiuse
    15. < HTTP/1.1 503 Service Unavailable
    16. < content-length: 19
    17. < content-type: text/plain
    18. < date: Thu, 07 Jul 2022 12:25:56 GMT
    19. < server: envoy
    20. <
    21. * Connection #0 to host localhost left intact
    22. # Flows for world identity
    23. $ kubectl -n kube-system exec ds/cilium -- hubble observe -f --identity 2
    24. Jul 7 12:28:27.970: 127.0.0.1:54704 <- 127.0.0.1:13681 http-response FORWARDED (HTTP/1.1 503 0ms (GET http://localhost:31911/))

    Alternatively, you can also send a request directly to the Envoy proxy port. For Ingress, the proxy port is randomly assigned by the Cilium Ingress controller. For manually configured CiliumEnvoyConfig resources, the proxy port is retrieved directly from the spec.

    1. $ kubectl logs -f -n kube-system ds/cilium --timestamps | egrep "envoy|proxy"
    2. ...
    3. 2022-07-08T08:05:13.986649816Z level=info msg="Adding new proxy port rules for cilium-ingress-default-basic-ingress:19672" proxy port name=cilium-ingress-default-basic-ingress subsys=proxy
    4. # After ssh to any of k8s node, send request to Envoy proxy port directly
    5. $ curl -v http://localhost:19672
    6. * Trying 127.0.0.1:19672...
    7. * TCP_NODELAY set
    8. * Connected to localhost (127.0.0.1) port 19672 (#0)
    9. > GET / HTTP/1.1
    10. > Host: localhost:19672
    11. > User-Agent: curl/7.68.0
    12. > Accept: */*
    13. >
    14. * Mark bundle as not supporting multiuse
    15. < HTTP/1.1 503 Service Unavailable
    16. < content-length: 19
    17. < content-type: text/plain
    18. < date: Fri, 08 Jul 2022 08:12:35 GMT
    19. < server: envoy

    If you see a response similar to the above, it means that the request is being redirected to proxy successfully. The http response will have one special header server: envoy accordingly. The same can be observed from hubble observe command Observing Flows with Hubble.

    The most common root cause is either that the Cilium Envoy proxy is not running on the node, or there is some other issue with CEC resource provisioning.

    1. $ kubectl exec -n kube-system ds/cilium -- cilium status
    2. ...
    3. Controller Status: 49/49 healthy
    4. Proxy Status: OK, ip 10.0.0.25, 6 redirects active on ports 10000-20000
    5. Global Identity Range: min 256, max 65535
  3. Assuming that the above steps are done successfully, you can proceed to send a request via an external IP or via FQDN next.

    Double-check whether your backend service is up and healthy. The Envoy Discovery Service (EDS) has a name that follows the convention <namespace>/<service-name>:<port>.

    1. $ LB_IP=$(kubectl get ingress basic-ingress -o json | jq '.status.loadBalancer.ingress[0].ip' | jq -r .)
    2. $ curl -s http://$LB_IP/details/1
    3. no healthy upstream
    4. $ kubectl get cec cilium-ingress-default-basic-ingress -o json | jq '.spec.resources[] | select(.type=="EDS")'
    5. {
    6. "@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
    7. "connectTimeout": "5s",
    8. "name": "default/details:9080",
    9. "outlierDetection": {
    10. "consecutiveLocalOriginFailure": 2,
    11. "splitExternalLocalOriginErrors": true
    12. },
    13. "type": "EDS",
    14. "typedExtensionProtocolOptions": {
    15. "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": {
    16. "@type": "type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions",
    17. "useDownstreamProtocolConfig": {
    18. "http2ProtocolOptions": {}
    19. }
    20. }
    21. }
    22. }
    23. {
    24. "@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
    25. "connectTimeout": "5s",
    26. "name": "default/productpage:9080",
    27. "outlierDetection": {
    28. "consecutiveLocalOriginFailure": 2,
    29. "splitExternalLocalOriginErrors": true
    30. },
    31. "type": "EDS",
    32. "typedExtensionProtocolOptions": {
    33. "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": {
    34. "@type": "type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions",
    35. "useDownstreamProtocolConfig": {
    36. "http2ProtocolOptions": {}
    37. }
    38. }
    39. }
    40. }

    If everything is configured correctly, you will be able to see the flows from world (identity 2), ingress (identity 8) and your backend pod as per below.

    1. # Flows for world identity
    2. $ kubectl exec -n kube-system ds/cilium -- hubble observe --identity 2 -f
    3. Defaulted container "cilium-agent" out of: cilium-agent, mount-cgroup (init), apply-sysctl-overwrites (init), mount-bpf-fs (init), clean-cilium-state (init)
    4. Jul 7 13:07:46.726: 192.168.49.1:59608 -> default/details-v1-5498c86cf5-cnt9q:9080 http-request FORWARDED (HTTP/1.1 GET http://10.97.60.117/details/1)
    5. Jul 7 13:07:46.727: 192.168.49.1:59608 <- default/details-v1-5498c86cf5-cnt9q:9080 http-response FORWARDED (HTTP/1.1 200 1ms (GET http://10.97.60.117/details/1))
    6. # Flows for Ingress identity (e.g. envoy proxy)
    7. $ kubectl exec -n kube-system ds/cilium -- hubble observe --identity 8 -f
    8. Defaulted container "cilium-agent" out of: cilium-agent, mount-cgroup (init), apply-sysctl-overwrites (init), mount-bpf-fs (init), clean-cilium-state (init)
    9. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: SYN)
    10. Jul 7 13:07:46.726: 10.0.0.95:42509 <- default/details-v1-5498c86cf5-cnt9q:9080 to-stack FORWARDED (TCP Flags: SYN, ACK)
    11. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: ACK)
    12. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: ACK, PSH)
    13. Jul 7 13:07:46.727: 10.0.0.95:42509 <- default/details-v1-5498c86cf5-cnt9q:9080 to-stack FORWARDED (TCP Flags: ACK, PSH)
    14. # Flows for backend pod, the identity can be retrieved via cilium identity list command
    15. $ kubectl exec -n kube-system ds/cilium -- hubble observe --identity 48847 -f
    16. Defaulted container "cilium-agent" out of: cilium-agent, mount-cgroup (init), apply-sysctl-overwrites (init), mount-bpf-fs (init), clean-cilium-state (init)
    17. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: SYN)
    18. Jul 7 13:07:46.726: 10.0.0.95:42509 <- default/details-v1-5498c86cf5-cnt9q:9080 to-stack FORWARDED (TCP Flags: SYN, ACK)
    19. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: ACK)
    20. Jul 7 13:07:46.726: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: ACK, PSH)
    21. Jul 7 13:07:46.726: 192.168.49.1:59608 -> default/details-v1-5498c86cf5-cnt9q:9080 http-request FORWARDED (HTTP/1.1 GET http://10.97.60.117/details/1)
    22. Jul 7 13:07:46.727: 10.0.0.95:42509 <- default/details-v1-5498c86cf5-cnt9q:9080 to-stack FORWARDED (TCP Flags: ACK, PSH)
    23. Jul 7 13:07:46.727: 192.168.49.1:59608 <- default/details-v1-5498c86cf5-cnt9q:9080 http-response FORWARDED (HTTP/1.1 200 1ms (GET http://10.97.60.117/details/1))
    24. Jul 7 13:08:16.757: 10.0.0.95:42509 <- default/details-v1-5498c86cf5-cnt9q:9080 to-stack FORWARDED (TCP Flags: ACK, FIN)
    25. Jul 7 13:08:16.757: 10.0.0.95:42509 -> default/details-v1-5498c86cf5-cnt9q:9080 to-endpoint FORWARDED (TCP Flags: ACK, FIN)
    26. # Sample output of cilium monitor
    27. $ ksysex ds/cilium -- cilium monitor
    28. level=info msg="Initializing dissection cache..." subsys=monitor
    29. -> endpoint 212 flow 0x3000e251 , identity ingress->61131 state new ifindex lxcfc90a8580fd6 orig-ip 10.0.0.192: 10.0.0.192:34219 -> 10.0.0.164:9080 tcp SYN
    30. -> stack flow 0x2481d648 , identity 61131->ingress state reply ifindex 0 orig-ip 0.0.0.0: 10.0.0.164:9080 -> 10.0.0.192:34219 tcp SYN, ACK
    31. -> endpoint 212 flow 0x3000e251 , identity ingress->61131 state established ifindex lxcfc90a8580fd6 orig-ip 10.0.0.192: 10.0.0.192:34219 -> 10.0.0.164:9080 tcp ACK
    32. -> endpoint 212 flow 0x3000e251 , identity ingress->61131 state established ifindex lxcfc90a8580fd6 orig-ip 10.0.0.192: 10.0.0.192:34219 -> 10.0.0.164:9080 tcp ACK
    33. -> Request http from 0 ([reserved:world]) to 212 ([k8s:io.cilium.k8s.namespace.labels.kubernetes.io/metadata.name=default k8s:io.cilium.k8s.policy.cluster=minikube k8s:io.cilium.k8s.policy.serviceaccount=bookinfo-details k8s:io.kubernetes.pod.namespace=default k8s:version=v1 k8s:app=details]), identity 2->61131, verdict Forwarded GET http://10.99.74.157/details/1 => 0
    34. -> stack flow 0x2481d648 , identity 61131->ingress state reply ifindex 0 orig-ip 0.0.0.0: 10.0.0.164:9080 -> 10.0.0.192:34219 tcp ACK
    35. -> Response http to 0 ([reserved:world]) from 212 ([k8s:io.kubernetes.pod.namespace=default k8s:version=v1 k8s:app=details k8s:io.cilium.k8s.namespace.labels.kubernetes.io/metadata.name=default k8s:io.cilium.k8s.policy.cluster=minikube k8s:io.cilium.k8s.policy.serviceaccount=bookinfo-details]), identity 61131->2, verdict Forwarded GET http://10.99.74.157/details/1 => 200

Symptom Library

Node to node traffic is being dropped

Symptom

Endpoint to endpoint communication on a single node succeeds but communication fails between endpoints across multiple nodes.

Troubleshooting steps:

  1. Run cilium-health status on the node of the source and destination endpoint. It should describe the connectivity from that node to other nodes in the cluster, and to a simulated endpoint on each other node. Identify points in the cluster that cannot talk to each other. If the command does not describe the status of the other node, there may be an issue with the KV-Store.

  2. Run cilium monitor on the node of the source and destination endpoint. Look for packet drops.

When running in Encapsulation mode:

  1. Run cilium bpf tunnel list and verify that each Cilium node is aware of the other nodes in the cluster. If not, check the logfile for errors.

  2. If nodes are being populated correctly, run tcpdump -n -i cilium_vxlan on each node to verify whether cross node traffic is being forwarded correctly between nodes.

    If packets are being dropped,

    • verify that the node IP listed in cilium bpf tunnel list can reach each other.

    • verify that the firewall on each node allows UDP port 8472.

When running in Native-Routing mode:

  1. Run ip route or check your cloud provider router and verify that you have routes installed to route the endpoint prefix between all nodes.

  2. Verify that the firewall on each node permits to route the endpoint IPs.

Useful Scripts

Retrieve Cilium pod managing a particular pod

Identifies the Cilium pod that is managing a particular pod in a namespace:

  1. k8s-get-cilium-pod.sh <pod> <namespace>

Example:

  1. $ curl -sLO https://raw.githubusercontent.com/cilium/cilium/master/contrib/k8s/k8s-get-cilium-pod.sh
  2. $ chmod +x k8s-get-cilium-pod.sh
  3. $ ./k8s-get-cilium-pod.sh luke-pod default
  4. cilium-zmjj9
  5. cilium-node-init-v7r9p
  6. cilium-operator-f576f7977-s5gpq

Execute a command in all Kubernetes Cilium pods

Run a command within all Cilium pods of a cluster

  1. k8s-cilium-exec.sh <command>

Example:

  1. $ curl -sLO https://raw.githubusercontent.com/cilium/cilium/master/contrib/k8s/k8s-cilium-exec.sh
  2. $ chmod +x k8s-cilium-exec.sh
  3. $ ./k8s-cilium-exec.sh uptime
  4. 10:15:16 up 6 days, 7:37, 0 users, load average: 0.00, 0.02, 0.00
  5. 10:15:16 up 6 days, 7:32, 0 users, load average: 0.00, 0.03, 0.04
  6. 10:15:16 up 6 days, 7:30, 0 users, load average: 0.75, 0.27, 0.15
  7. 10:15:16 up 6 days, 7:28, 0 users, load average: 0.14, 0.04, 0.01

List unmanaged Kubernetes pods

Lists all Kubernetes pods in the cluster for which Cilium does not provide networking. This includes pods running in host-networking mode and pods that were started before Cilium was deployed.

  1. k8s-unmanaged.sh

Example:

  1. $ curl -sLO https://raw.githubusercontent.com/cilium/cilium/master/contrib/k8s/k8s-unmanaged.sh
  2. $ chmod +x k8s-unmanaged.sh
  3. $ ./k8s-unmanaged.sh
  4. kube-system/cilium-hqpk7
  5. kube-system/kube-addon-manager-minikube
  6. kube-system/kube-dns-54cccfbdf8-zmv2c
  7. kube-system/kubernetes-dashboard-77d8b98585-g52k5
  8. kube-system/storage-provisioner

Reporting a problem

Before you report a problem, make sure to retrieve the necessary information from your cluster before the failure state is lost.

Automatic log & state collection

Install the latest version of the Cilium CLI. The Cilium CLI can be used to install Cilium, inspect the state of a Cilium installation, and enable/disable various features (e.g. clustermesh, Hubble).

LinuxmacOSOther

  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
  1. CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/master/stable.txt)
  2. CLI_ARCH=amd64
  3. if [ "$(uname -m)" = "arm64" ]; then CLI_ARCH=arm64; fi
  4. curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}
  5. shasum -a 256 -c cilium-darwin-${CLI_ARCH}.tar.gz.sha256sum
  6. sudo tar xzvfC cilium-darwin-${CLI_ARCH}.tar.gz /usr/local/bin
  7. rm cilium-darwin-${CLI_ARCH}.tar.gz{,.sha256sum}

See the full page of releases.

Then, execute cilium sysdump command to collect troubleshooting information from your Kubernetes cluster:

  1. cilium sysdump

Note that by default cilium sysdump will attempt to collect as much logs as possible and for all the nodes in the cluster. If your cluster size is above 20 nodes, consider setting the following options to limit the size of the sysdump. This is not required, but useful for those who have a constraint on bandwidth or upload size.

  • set the --node-list option to pick only a few nodes in case the cluster has many of them.

  • set the --logs-since-time option to go back in time to when the issues started.

  • set the --logs-limit-bytes option to limit the size of the log files (note: passed onto kubectl logs; does not apply to entire collection archive).

Ideally, a sysdump that has a full history of select nodes, rather than a brief history of all the nodes, would be preferred (by using --node-list). The second recommended way would be to use --logs-since-time if you are able to narrow down when the issues started. Lastly, if the Cilium agent and Operator logs are too large, consider --logs-limit-bytes.

Use --help to see more options:

  1. cilium sysdump --help

Single Node Bugtool

If you are not running Kubernetes, it is also possible to run the bug collection tool manually with the scope of a single node:

The cilium-bugtool captures potentially useful information about your environment for debugging. The tool is meant to be used for debugging a single Cilium agent node. In the Kubernetes case, if you have multiple Cilium pods, the tool can retrieve debugging information from all of them. The tool works by archiving a collection of command output and files from several places. By default, it writes to the tmp directory.

Note that the command needs to be run from inside the Cilium pod/container.

  1. cilium-bugtool

When running it with no option as shown above, it will try to copy various files and execute some commands. If kubectl is detected, it will search for Cilium pods. The default label being k8s-app=cilium, but this and the namespace can be changed via k8s-namespace and k8s-label respectively.

If you want to capture the archive from a Kubernetes pod, then the process is a bit different

  1. $ # First we need to get the Cilium pod
  2. $ kubectl get pods --namespace kube-system
  3. NAME READY STATUS RESTARTS AGE
  4. cilium-kg8lv 1/1 Running 0 13m
  5. kube-addon-manager-minikube 1/1 Running 0 1h
  6. kube-dns-6fc954457d-sf2nk 3/3 Running 0 1h
  7. kubernetes-dashboard-6xvc7 1/1 Running 0 1h
  8. $ # Run the bugtool from this pod
  9. $ kubectl -n kube-system exec cilium-kg8lv -- cilium-bugtool
  10. [...]
  11. $ # Copy the archive from the pod
  12. $ kubectl cp kube-system/cilium-kg8lv:/tmp/cilium-bugtool-20180411-155146.166+0000-UTC-266836983.tar /tmp/cilium-bugtool-20180411-155146.166+0000-UTC-266836983.tar
  13. [...]

Note

Please check the archive for sensitive information and strip it away before sharing it with us.

Below is an approximate list of the kind of information in the archive.

  • Cilium status

  • Cilium version

  • Kernel configuration

  • Resolve configuration

  • Cilium endpoint state

  • Cilium logs

  • Docker logs

  • dmesg

  • ethtool

  • ip a

  • ip link

  • ip r

  • iptables-save

  • kubectl -n kube-system get pods

  • kubectl get pods,svc for all namespaces

  • uname

  • uptime

  • cilium bpf * list

  • cilium endpoint get for each endpoint

  • cilium endpoint list

  • hostname

  • cilium policy get

  • cilium service list

Debugging information

If you are not running Kubernetes, you can use the cilium debuginfo command to retrieve useful debugging information. If you are running Kubernetes, this command is automatically run as part of the system dump.

cilium debuginfo can print useful output from the Cilium API. The output format is in Markdown format so this can be used when reporting a bug on the issue tracker. Running without arguments will print to standard output, but you can also redirect to a file like

  1. cilium debuginfo -f debuginfo.md

Note

Please check the debuginfo file for sensitive information and strip it away before sharing it with us.

Slack Assistance

The Cilium slack community is helpful first point of assistance to get help troubleshooting a problem or to discuss options on how to address a problem.

The slack community is open to everyone. You can request an invite email by visiting Slack.

Report an issue via GitHub

If you believe to have found an issue in Cilium, please report a GitHub issue and make sure to attach a system dump as described above to ensure that developers have the best chance to reproduce the issue.