Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Link two clusters with Cilium ClusterMesh

By updated

Improve this page

ClusterMesh is the Cilium feature that lets each cluster see the nodes and Services of the other: a Service declared "global" is then served by the Pods of both clusters, and it keeps answering when one of the two has no backend left. This lesson prepares two kubeadm clusters, installs Cilium 1.20.5 in them, links them with cilium clustermesh connect, declares a global Service and calls it 12 times to see where the answers come from. It also shows the two errors that block the installation (a clustermesh-apiserver Pod that never becomes ready, and a copied secret that Helm refuses). It is aimed at readers who already administer a Cilium cluster and must make two of them talk to each other.

What you will learn

  • Say what linking two clusters is for, and what ClusterMesh shares and does not share.
  • Prepare two clusters that can be linked: distinct cluster.name and cluster.id, disjoint Pod address ranges, the same certificate authority.
  • Link the clusters with cilium clustermesh connect and read cilium clustermesh status and cilium-dbg node list.
  • Declare a global Service with service.cilium.io/global: "true", prove that the answers come from both clusters and observe that it still answers when the local cluster has no Pod left.
  • Diagnose the two installation errors met during the demonstration.
  • Protect the link: the CA key passed to Helm and the port exposed by the mesh API.

Prerequisites

  • The lesson Install Cilium without kube-proxy and choose your IPAM, which installs Cilium with Helm on a kubeadm cluster without kube-proxy: this lesson repeats the same installation twice.
  • The lesson Services, to know what a Service is and how it chooses its Pods.
  • Knowing how to read a Deployment and a Pod with kubectl, and how to use Helm to install and upgrade a chart.
  • Two Ubuntu 24.04 machines that can reach each other on the network, accessible over ssh with sudo. Each one carries the kubeadm and kubelet packages (1.37.2), kubectl and containerd. The lesson creates on each a single-node cluster with kubeadm init: the demonstration proves the connection between clusters, not their number of nodes.
  • In the demonstration, ha-cp1 reaches ha-cp2 over ssh and has passwordless sudo on ha-cp2. Fetching admin.conf and copying the files assume it. Without this access, get these files another way.
  • The demonstration outputs were captured on 17 November 2026 with Cilium 1.20.4, the cilium CLI v0.20.3 and Helm 4.3.2. The commands in this lesson install version 1.20.5. On 1.20.5, the connection and wait lines and the split of the twelve calls are the same, with the differences noted in the text. The cilium image (stable) line of cilium version dates from 18 November 2026.

These values are those of the demonstration. On your side, replace them as follows:

In the lessonWhat you use instead
cluster-1, cluster-2the name you give each cluster, unique in the mesh
10.10.50.18, 10.10.50.19the address of each node (kubectl get nodes -o wide, INTERNAL-IP column)
10.241.0.0/16, 10.242.0.0/16a different Pod range for each cluster
10.111.0.0/16, 10.112.0.0/16the Service range of each cluster (passed to kubeadm init)

Two independent clusters do not see each other: a Pod in the first knows neither the Services nor the Pods of the second. You link clusters so that an application survives the loss of one of them, to spread a service across two regions, or so that one cluster consumes a Service hosted in the other. That is what Cilium ClusterMesh provides: the Cilium agents of each cluster learn the nodes and Services of the other, and traffic flows from one cluster to the other without going through an external load balancer.

ClusterMesh merges nothing. Each cluster keeps its own control plane, its own objects and its own Services. The mesh only adds a shared view: the nodes of the other cluster appear in cilium-dbg node list, and the Services declared "global" gather the backends of both sides. What is not declared global stays local.

What must you prepare before linking the clusters?

Four conditions must be met before the installation. They come from the Cilium 1.20 documentation (the ClusterMesh setup page, as of 2026-11-17), and each has a reason.

  • A unique cluster.name and cluster.id. The name (32 characters at most) and the identifier (from 1 to 255 by default) tell the clusters apart in the shared view: cluster-2/ha-cp2.lab designates a node without ambiguity. The documentation asks for a different name and identifier in each cluster.
  • Disjoint Pod address ranges, and nodes that reach each other by their internal address. A Pod reaches a Pod of the other cluster directly, by its address. If both clusters hand out addresses from the same range, one address designates two different Pods and routing can no longer choose.
  • A common certificate authority. A certificate authority (CA) is the entity whose key signs certificates: a certificate is accepted only if it is signed by a CA you trust. Each cluster connects to the mesh API of the other over TLS, with a client certificate. With KVStoreMesh, enabled by default, it is the kvstoremesh containers of the clustermesh-apiserver Pod that make this connection, not the agents. Each cluster must therefore trust the certificates presented by the other. The documentation indicates either a common root authority, or a trust list (tls.caBundle) that contains all the authorities. The demonstration takes the first way, with cilium-ca.
  • The same basic settings. The documentation asks for the same routing mode in all clusters and a gap of one minor Cilium version at most. The demonstration installs the same version, 1.20.5, everywhere.

The demonstration follows these rules with these values:

cluster-1cluster-2
Nodeha-cp1.lab (10.10.50.18)ha-cp2.lab (10.10.50.19)
cluster.id12
Pod range10.241.0.0/1610.242.0.0/16
Service range10.111.0.0/1610.112.0.0/16

The diagram shows what these conditions make possible. Each cluster runs a clustermesh-apiserver Pod, which publishes its nodes and Services, and exposes it as a NodePort: a Service of type NodePort opens the same port, here 32379, on every node of the cluster. The two thick arrows show that each cluster reads the API of the other (it is kvstoremesh that reads it). The dotted lines show the cilium-ca authority, the same on both sides, which signs the certificates of these connections.

Two clusters, cluster-1 on node ha-cp1 (10.10.50.18, cluster.id 1, Pods 10.241.0.0/16) and cluster-2 on node ha-cp2 (10.10.50.19, cluster.id 2, Pods 10.242.0.0/16). Each runs a clustermesh-apiserver exposed as a NodePort on port 32379. Two thick arrows show that cluster-2 reads the clustermesh-apiserver of cluster-1 and that cluster-1 reads that of cluster-2. The same certificate authority cilium-ca, dotted, is linked to both.     Same cilium-ca authority     in both clustersclustermesh-apiserverNodePort 32379clustermesh-apiserverNodePort 32379Node ha-cp1 10.10.50.18cluster.id 1, Pods 10.241.0.0/16 read by cluster-2  read by cluster-1 Node ha-cp2 10.10.50.19cluster.id 2, Pods 10.242.0.0/16cluster-1cluster-2
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

How do you install Cilium in both clusters?

First create two kubeadm clusters without kube-proxy, with different Pod and Service ranges. On ha-cp1, for cluster-1:

Terminal window
sudo kubeadm init --skip-phases=addon/kube-proxy \
--pod-network-cidr=10.241.0.0/16 --service-cidr=10.111.0.0/16 \
--apiserver-advertise-address=10.10.50.18

On ha-cp2, run the same command with 10.242.0.0/16, 10.112.0.0/16 and 10.10.50.19. Both answer Your Kubernetes control-plane has initialized successfully!. Then install Helm on each node, and run these three commands on each:

Terminal window
sudo helm --kubeconfig /etc/kubernetes/admin.conf repo add cilium https://helm.cilium.io
sudo helm --kubeconfig /etc/kubernetes/admin.conf repo update
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/control-plane-

The repository is added under sudo because the Cilium installation is also run under sudo: Helm then reads root's repository list, not that of your account. Since each cluster has a single node, the last command removes the mark (the taint) that forbids placing Pods on it.

Cilium is then installed with Helm, as in the Cilium lesson, with the mesh settings added. For cluster-1:

Terminal window
sudo helm --kubeconfig /etc/kubernetes/admin.conf install cilium cilium/cilium \
--version 1.20.5 --namespace kube-system \
--set kubeProxyReplacement=true \
--set k8sServiceHost=10.10.50.18 --set k8sServicePort=6443 \
--set ipam.mode=cluster-pool \
--set ipam.operator.clusterPoolIPv4PodCIDRList={10.241.0.0/16} \
--set cluster.name=cluster-1 --set cluster.id=1 \
--set operator.replicas=1 \
--set clustermesh.useAPIServer=true \
--set clustermesh.apiserver.service.type=NodePort \
--set clustermesh.apiserver.tls.auto.method=helm \
--set clustermesh.config.enabled=true

The cluster.* and clustermesh.* settings are those of the mesh:

  • cluster.name and cluster.id identify the cluster.
  • clustermesh.useAPIServer=true deploys the clustermesh-apiserver Pod, which publishes the nodes and Services of the cluster.
  • clustermesh.apiserver.service.type=NodePort exposes it on a port of every node, here 32379.
  • clustermesh.apiserver.tls.auto.method=helm makes Helm generate the certificates of this API.
  • clustermesh.config.enabled=true makes Helm create the clustermesh-remote-users ConfigMap, which declares one user per remote cluster to read the mesh API.

The clustermesh-apiserver Pod mounts this ConfigMap as a volume: without clustermesh.config.enabled=true, it never becomes ready (see the troubleshooting section).

For cluster-2, you must first give Helm the certificate authority of cluster-1. Helm generates its own cilium-ca authority at each installation: two independent installations produce two different authorities, and the clusters would not trust each other. So you read the certificate and the key of cilium-ca in cluster-1, then pass them to the installation of cluster-2 through a Helm values file.

The Cilium documentation describes another way: copying the cilium-ca Secret from one cluster to the other with kubectl, before enabling the mesh on a cluster where Cilium is already installed. This lesson does not use it. On a new installation, the copy makes helm install refuse instead (see the troubleshooting section).

The key of a certificate authority is a secret: whoever holds it can sign a certificate that both clusters will accept. So do not display it in the terminal: read the certificate and the key (in base64) from the cilium-ca secret and write ca-valeurs.yaml directly on ha-cp1 by redirection, under umask 077 so that only its owner can read it, then copy it to ha-cp2 with scp.

Terminal window
( umask 077
{
echo "tls:"
echo " ca:"
echo " cert: $(sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system get secret cilium-ca -o jsonpath='{.data.ca\.crt}')"
echo " key: $(sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system get secret cilium-ca -o jsonpath='{.data.ca\.key}')"
} > ca-valeurs.yaml )
scp ca-valeurs.yaml ha-cp2.lab:
rm -f ca-valeurs.yaml

The file produced has this shape, and you do not need to open it:

tls:
ca:
cert: <base64 content of ca.crt>
key: <base64 content of ca.key>

Then you install cluster-2 with this file. The command is the same as for cluster-1, with -f ca-valeurs.yaml added and the values specific to cluster-2:

Terminal window
sudo helm --kubeconfig /etc/kubernetes/admin.conf install cilium cilium/cilium \
--version 1.20.5 --namespace kube-system -f ca-valeurs.yaml \
--set kubeProxyReplacement=true \
--set k8sServiceHost=10.10.50.19 --set k8sServicePort=6443 \
--set ipam.mode=cluster-pool \
--set ipam.operator.clusterPoolIPv4PodCIDRList={10.242.0.0/16} \
--set cluster.name=cluster-2 --set cluster.id=2 \
--set operator.replicas=1 \
--set clustermesh.useAPIServer=true \
--set clustermesh.apiserver.service.type=NodePort \
--set clustermesh.apiserver.tls.auto.method=helm \
--set clustermesh.config.enabled=true
rm -f ca-valeurs.yaml

The rm -f deletes on ha-cp2 the copy of the values file as soon as the installation is done. The installation prints:

NAME: cilium
LAST DEPLOYED: Tue Nov 17 18:33:13 2026
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
TEST SUITE: None

Install complete only says that Helm created the objects. The authority key does not stop at ca-valeurs.yaml: Helm recreates the cilium-ca secret of cluster-2 with it, and it keeps the installation values in the release secret (sh.helm.release.v1.cilium.v<N>, one secret per revision, in kube-system), where helm get values cilium -n kube-system reads them back. This reading through helm get values follows from how Helm works, which returns the values passed at installation. Deleting the file after the installation therefore does not remove the key from these two secrets: anyone who can read the secrets of kube-system, in cluster-1 or in cluster-2, can read it. Limit this right with RBAC.

Now wait for the agent and the mesh Pod to be ready, on each cluster:

Terminal window
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system rollout status ds/cilium --timeout=300s
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system rollout status deploy/clustermesh-apiserver --timeout=300s
Waiting for daemon set "cilium" rollout to finish: 0 of 1 updated pods are available...
daemon set "cilium" successfully rolled out
Waiting for deployment "clustermesh-apiserver" rollout to finish: 0 of 1 updated replicas are available...
deployment "clustermesh-apiserver" successfully rolled out

The two successfully rolled out lines say that the agent and the mesh API are running. What remains is to check that the authority really is the same: you compare the fingerprint of the cilium-ca certificate, with the following command run first on ha-cp1, then on ha-cp2.

Terminal window
sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system \
get secret cilium-ca -o jsonpath='{.data.ca\.crt}' | sha256sum
3cc03ce0c296336cacdce497135b33637dae28db5273fd7881e2ba927731f301 -
3cc03ce0c296336cacdce497135b33637dae28db5273fd7881e2ba927731f301 -

The two fingerprints are identical (the first comes from ha-cp1, the second from ha-cp2): the clusters share the same authority.

How do you install the cilium CLI and reach both clusters?

The connection command is run from a single workstation that reaches both clusters, with a kubeconfig that contains both contexts. The cilium CLI v0.20.3 is downloaded from the releases of the cilium/cilium-cli repository, with verification of its SHA-256 sum:

Terminal window
curl -sSLO https://github.com/cilium/cilium-cli/releases/download/v0.20.3/cilium-linux-amd64.tar.gz
curl -sSLO https://github.com/cilium/cilium-cli/releases/download/v0.20.3/cilium-linux-amd64.tar.gz.sha256sum
sha256sum -c cilium-linux-amd64.tar.gz.sha256sum
sudo tar -xzf cilium-linux-amd64.tar.gz -C /usr/local/bin
cilium version --client
cilium-linux-amd64.tar.gz: OK
cilium-cli: v0.20.3 compiled with go1.27.3 on linux/amd64
cilium image (default): v1.20.3
cilium image (stable): v1.20.5

OK confirms that the sum matches. The cilium image (stable) line (v1.20.5) was captured on 18 November 2026. The cilium image (default) line says v1.20.3: it is the image the v0.20.3 CLI would install with no instruction. It has no effect here, since Helm installs the clusters in 1.20.5. If you install Cilium with the CLI (cilium install) instead of Helm, pass --version 1.20.5, otherwise you get 1.20.3.

To reach both clusters, you merge their two admin.conf files into one. Both files give the same names to the cluster (kubernetes), the user (kubernetes-admin) and the context (kubernetes-admin@kubernetes). You must rename these three entries before the merge, otherwise one overwrites the other. The demonstration works from ha-cp1, which carries the CLI: it fetches the admin.conf of ha-cp2 there over ssh, then renames and merges.

This series of commands assumes ssh access from ha-cp1 to ha-cp2 and passwordless sudo on ha-cp2, because kubeadm creates this file readable by root only: if sudo asks for a password, the command fails, and you must get the file another way, for example by copying it with an account that can read it. It is written under umask 077, so that /tmp/c2.conf is not readable by the other accounts of the machine. From another workstation, fetch the two files the same way.

Terminal window
( umask 077; ssh ha-cp2.lab "sudo cat /etc/kubernetes/admin.conf" > /tmp/c2.conf )
sudo cp /etc/kubernetes/admin.conf /tmp/c1.conf
sudo chown $(id -u) /tmp/c1.conf
sed -i 's/kubernetes-admin@kubernetes/cluster-1/; s/name: kubernetes$/name: k8s-cluster-1/; s/cluster: kubernetes$/cluster: k8s-cluster-1/; s/name: kubernetes-admin$/name: admin-cluster-1/; s/user: kubernetes-admin$/user: admin-cluster-1/' /tmp/c1.conf
sed -i 's/kubernetes-admin@kubernetes/cluster-2/; s/name: kubernetes$/name: k8s-cluster-2/; s/cluster: kubernetes$/cluster: k8s-cluster-2/; s/name: kubernetes-admin$/name: admin-cluster-2/; s/user: kubernetes-admin$/user: admin-cluster-2/' /tmp/c2.conf
mkdir -p ~/.kube
( umask 077; KUBECONFIG=/tmp/c1.conf:/tmp/c2.conf kubectl config view --flatten > ~/.kube/mesh.conf )
chmod 600 ~/.kube/mesh.conf
rm -f /tmp/c1.conf /tmp/c2.conf

The sed commands rename the context, the cluster and the user of each file; kubectl config view --flatten produces the single file, and chmod 600 reserves it for its owner (it contains the administrator credentials of both clusters). The copies are deleted.

So that kubectl and cilium read this file without having to repeat it in every command, you designate it once for the whole terminal session:

Terminal window
export KUBECONFIG=~/.kube/mesh.conf

Without this variable, they would read ~/.kube/config, which does not contain these two contexts. All the kubectl --context … and cilium … commands that follow, up to the cleanup, rely on this variable. If you open another terminal, run the export line again. In the demonstration, the file carries two contexts:

Terminal window
kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* cluster-1 k8s-cluster-1 admin-cluster-1
cluster-2 k8s-cluster-2 admin-cluster-2

The cluster-1 and cluster-2 contexts are those the CLI will receive with --context and --destination-context. The current context, marked *, is cluster-1: a kubectl run without --context therefore targets cluster-1.

First look at the state before the connection. The cilium clustermesh status command reads the mesh Pod of each cluster:

Terminal window
cilium clustermesh status --context cluster-1
⚠️ Service type NodePort detected! Service may fail when nodes are removed from the cluster!
✅ Service "clustermesh-apiserver" of type "NodePort" found
✅ Cluster access information is available:
- 10.10.50.18:32379
✅ Deployment clustermesh-apiserver is ready
ℹ️ KVStoreMesh is enabled
🔌 No cluster connected

The three checkmarks say that the mesh API is running and reachable at 10.10.50.18:32379. The last line, No cluster connected, is the expected state: nothing is linked yet. The NodePort warning comes from the CLI: a clustermesh-apiserver exposed as a NodePort depends on the nodes of the cluster, and it may stop working when some are removed. On a single demonstration node there is nothing to worry about; the section on limits says what to choose on a real cluster.

The KVStoreMesh is enabled line signals a kvstoremesh container in the same Pod. It is the one that connects to the mesh API of the remote cluster and copies into a local etcd database (that of the mesh Pod, distinct from the Kubernetes etcd) the information it reads there. The Cilium agents read this local database, not the other cluster.

The connection is made with one command, run once. It configures both directions:

Terminal window
cilium clustermesh connect \
--context cluster-1 --destination-context cluster-2
✨ Extracting access information of cluster cluster-1...
🔑 Extracting secrets from cluster cluster-1...
⚠️ Service type NodePort detected! Service may fail when nodes are removed from the cluster!
ℹ️ Found ClusterMesh service IPs: [10.10.50.18]
✨ Extracting access information of cluster cluster-2...
🔑 Extracting secrets from cluster cluster-2...
⚠️ Service type NodePort detected! Service may fail when nodes are removed from the cluster!
ℹ️ Found ClusterMesh service IPs: [10.10.50.19]
ℹ️ Configuring Cilium in cluster k8s-cluster-1 to connect to cluster k8s-cluster-2
2026/11/17 18:34:24 warning: destination for cilium.clustermesh.config.clusters is a table. Ignoring non-table value ([])
ℹ️ Configuring Cilium in cluster k8s-cluster-2 to connect to cluster k8s-cluster-1
2026/11/17 18:34:26 warning: destination for cilium.clustermesh.config.clusters is a table. Ignoring non-table value ([])
✅ Connected cluster k8s-cluster-1 <=> k8s-cluster-2!

The command reads the address and the certificates of each cluster, then writes them into the configuration of the other, which lets kvstoremesh connect to it: this is the thick arrow of the diagram. It runs a helm upgrade on each cluster, hence one more revision and one more sh.helm.release.v1.cilium.v<N> secret. The last line, Connected cluster k8s-cluster-1 <=> k8s-cluster-2!, is the success. It names the clusters k8s-cluster-1 and k8s-cluster-2, that is, by the cluster name in the merged kubeconfig, not by the context name (cluster-1) passed to --context. The two warning: destination for cilium.clustermesh.config.clusters is a table lines are a message from the Helm library, which the CLI uses to update the Cilium configuration; the command ends well and the clusters connect.

The link takes a few seconds to establish. You wait with --wait, first on cluster-1, then the same way on cluster-2:

Terminal window
cilium clustermesh status --context cluster-1 --wait --wait-duration 5m
⚠️ Service type NodePort detected! Service may fail when nodes are removed from the cluster!
✅ Service "clustermesh-apiserver" of type "NodePort" found
✅ Cluster access information is available:
- 10.10.50.18:32379
⌛ Waiting (0s) for deployment clustermesh-apiserver to become ready: only 1 of 2 replicas are available
✅ Deployment clustermesh-apiserver is ready
ℹ️ KVStoreMesh is enabled
⌛ Waiting (0s) for clusters to be connected: unable to determine status of pod "clustermesh-apiserver-64fddf6f7b-2rnff": command failed (pod=kube-system/clustermesh-apiserver-64fddf6f7b-2rnff, container=kvstoremesh): command terminated with exit code 137
⌛ Waiting (10s) for clusters to be connected: 1 nodes are not ready
⌛ Waiting (20s) for clusters to be connected: 1 nodes are not ready
✅ All 1 nodes are connected to all clusters [min:1 / avg:1.0 / max:1]
✅ All 1 KVStoreMesh replicas are connected to all clusters [min:1 / avg:1.0 / max:1]
🔌 Cluster Connections:
- cluster-2: 1/1 configured, 1/1 connected - KVStoreMesh: 1/1 configured, 1/1 connected

The ⌛ lines are waits, not errors. only 1 of 2 replicas are available shows that the mesh deployment is updating after the connection is configured, and the 137 code of the kvstoremesh container is that of a killed container, here during the deployment update. The nodes then connect.

On 1.20.5, the same sequence appears, with another message in place of code 137: unable to upgrade connection: container not found ("kvstoremesh"). This message suggests that the container no longer existed when the request was made, probably because the deployment was updating; no source establishes it, it is a hypothesis. In both cases, the command ends up succeeding without any action. On 1.20.5, the connection is established 20 to 30 seconds after connect: allow half a minute before concluding there is a failure.

What matters is the end: All 1 nodes are connected to all clusters, then cluster-2: 1/1 configured, 1/1 connected. The same check on cluster-2 must end with cluster-1: 1/1 configured, 1/1 connected, which the demonstration obtained.

The most direct proof of the shared view is the list of nodes that the agent of cluster-1 sees:

Terminal window
kubectl --context cluster-1 -n kube-system \
exec ds/cilium -c cilium-agent -- cilium-dbg node list
Name IPv4 Address Endpoint CIDR IPv6 Address Endpoint CIDR Source
cluster-1/ha-cp1.lab 10.10.50.18 10.241.0.0/24 local
cluster-2/ha-cp2.lab 10.10.50.19 10.242.0.0/24 clustermesh

The name is prefixed by the cluster, which is why cluster.name matters. The Source column tells apart the local node (local) from the one that comes from the other cluster (clustermesh). Each node also announces a Pod range taken from the range of its cluster, 10.241.0.0/24 and 10.242.0.0/24.

What is a global Service?

A Service is global when it carries the service.cilium.io/global: "true" annotation. Cilium then gathers the backends of all the Services of that name, in that namespace, across the linked clusters. The Service is not copied from one cluster to the other: each cluster declares it itself. The rule is simple and can be checked: the Service must have the same name and the same namespace in each cluster, and the annotation must be set in each one.

A Service without the annotation stays local: its backends are those of the cluster, nothing more. The next section measures the difference between the two.

How do you prove that answers come from both clusters?

You deploy in each cluster the same echo Deployment and the same Service, in the mesh-demo namespace. Each Pod answers with the name of its cluster. Here is the manifest for cluster-1; for cluster-2, replace reponse-de-cluster-1 with reponse-de-cluster-2:

apiVersion: apps/v1
kind: Deployment
metadata: {name: echo, namespace: mesh-demo}
spec:
replicas: 1
selector: {matchLabels: {app: echo}}
template:
metadata: {labels: {app: echo}}
spec:
containers:
- name: c
image: busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec
command: [sh, -c, 'echo reponse-de-cluster-1 > /tmp/index.html; httpd -f -p 8080 -h /tmp']
---
apiVersion: v1
kind: Service
metadata:
name: echo
namespace: mesh-demo
annotations:
service.cilium.io/global: "true"
spec:
selector: {app: echo}
ports: [{port: 80, targetPort: 8080}]

You create the mesh-demo namespace in each cluster, apply the manifest in each and wait for the Deployment to be ready. Each command carries its --context, so that none goes by mistake to the current context. First save the manifest above as echo.yaml (answer of cluster-1); the sed makes the cluster-2 version from it.

Terminal window
kubectl --context cluster-1 create namespace mesh-demo
kubectl --context cluster-1 apply -f echo.yaml
kubectl --context cluster-2 create namespace mesh-demo
sed 's/reponse-de-cluster-1/reponse-de-cluster-2/' echo.yaml | kubectl --context cluster-2 apply -f -
kubectl --context cluster-1 -n mesh-demo rollout status deploy/echo --timeout=120s
kubectl --context cluster-2 -n mesh-demo rollout status deploy/echo --timeout=120s

You then start a client Pod, in cluster-1 only:

Terminal window
kubectl --context cluster-1 -n mesh-demo run client \
--image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec \
--restart=Never -- sleep 3600
kubectl --context cluster-1 -n mesh-demo wait --for=condition=Ready pod/client --timeout=120s
pod/client created
pod/client condition met

Before calling the Service, look at what the Cilium agent knows about it. The cilium-dbg service list command prints the table of Services and their backends:

Terminal window
kubectl --context cluster-1 -n kube-system exec ds/cilium -c cilium-agent -- \
cilium-dbg service list | grep -A3 ':80/TCP' | head -16
9 10.111.185.8:80/TCP ClusterIP 1 => 10.241.0.112:8080/TCP (active)
2 => 10.242.0.83:8080/TCP (active)

The 10.111.185.8:80 Service of cluster-1 has two backends: 10.241.0.112 is in the Pod range of cluster-1, 10.242.0.83 in that of cluster-2. A global Service therefore lists Pods of both clusters, which a local Service would not. The next diagram shows the path: the client calls the Service, and the Service picks one of the two backends. The numbers of answers it carries come from the series of calls that follows.

A client Pod in cluster-1 calls the echo Service (10.111.185.8:80), annotated service.cilium.io/global=true. The Service has two backends: a Pod in cluster-1 (10.241.0.112:8080), which served 8 answers out of 12, and a Pod in cluster-2 (10.242.0.83:8080), which served 4 out of 12.8 answers out of 124 answers out of 12​     Client Pod​     in cluster-1​     Service echo (10.111.185.8:80)​     annotation service.cilium.io/global=trueBackend in cluster-110.241.0.112:8080Backend in cluster-210.242.0.83:8080
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

You now call the Service 12 times from the client, and count the answers:

Terminal window
for i in $(seq 1 12); do
kubectl --context cluster-1 -n mesh-demo exec client -- wget -qO- -T 3 http://echo.mesh-demo/
done | sort | uniq -c
8 reponse-de-cluster-1
4 reponse-de-cluster-2

The client, which lives only in cluster-1, received answers from cluster-2: the Service is indeed served by both clusters. The split of this series is 8 against 4, and a series of 12 calls is not enough to draw a rule from. It only proves that both clusters answer.

What happens when the local cluster has no backend left?

This is the point of the global Service: it keeps answering when the client's cluster has no Pod left for this Service. The demonstration does not shut down a whole cluster: it scales the Deployment in cluster-1 to zero, which makes the Pods of the Service disappear from that cluster, and the cluster itself keeps running. The shutdown of a complete cluster is not covered by this demonstration. You give Cilium 10 seconds to remove the backend, and call the Service 8 times:

Terminal window
kubectl --context cluster-1 -n mesh-demo scale deploy/echo --replicas=0
sleep 10
for i in $(seq 1 8); do
kubectl --context cluster-1 -n mesh-demo exec client -- wget -qO- -T 3 http://echo.mesh-demo/
done | sort | uniq -c
deployment.apps/echo scaled
8 reponse-de-cluster-2

All 8 answers come from cluster-2, without a single error: when the Pods of one cluster disappear, the Service keeps being served by the other. The client changed nothing: it still calls http://echo.mesh-demo/, and the Service removed the backend of cluster-1 from its list. Without a global Service, the same request would have no backend at all. You then restore one replica (scale deploy/echo --replicas=1) and wait for it to be ready with rollout status deploy/echo.

The counter-test shows what the annotation does. You remove it from the Service of cluster-1, then call again 8 times:

Terminal window
kubectl --context cluster-1 -n mesh-demo annotate service echo service.cilium.io/global-
sleep 10
for i in $(seq 1 8); do
kubectl --context cluster-1 -n mesh-demo exec client -- wget -qO- -T 3 http://echo.mesh-demo/
done | sort | uniq -c
service/echo annotated
8 reponse-de-cluster-1

Without the annotation, all 8 answers come from cluster-1: the Service has become local again, even though cluster-2 still carries a Service of the same name. The annotation set on the cluster-1 side therefore decides whether this cluster sees the backends of the other. You put it back with annotate service echo service.cilium.io/global=true --overwrite.

The Cilium 1.20 documentation describes other annotations, such as service.cilium.io/affinity (prefer local or remote backends) and service.cilium.io/shared (expose or not its backends to the other cluster), as well as network policies between clusters. This lesson does not cover them: read the global Services page before using them.

Port 32379 of the clustermesh-apiserver is open on every node: any machine that reaches this port can attempt a connection. The mesh API requires a client certificate signed by the common CA cilium-ca. With KVStoreMesh, it is kvstoremesh that presents to the remote cluster the certificate named remote (CN remote with the default authentication mode, according to the Cilium documentation). The demonstration does not attempt a connection without a certificate.

If you run cilium-dbg troubleshoot clustermesh in the agent of cluster-1, the command prints a CN=local-cluster-1 certificate. It has nothing to do with the remote certificate: it is the one the agents use toward the local etcd of the mesh Pod of their own cluster, issued by CN=Cilium CA. It does not protect the port exposed to the other cluster.

Two protective steps follow. The first is to limit with a firewall access to port 32379 to the addresses of the nodes of the other cluster only (this lesson does not set up this filtering). The second is to protect the cilium-ca key as seen above, since a certificate signed by it is accepted on both sides.

Certificates also have an end date. With tls.auto.method=helm, leaf certificates last 365 days by default (clustermesh.apiserver.tls.auto.certValidityDuration) and the CA 1095 days (tls.ca.certValidityDuration), which the demonstration read on 17 November 2026: a client certificate valid until 17 November 2027 and a CA valid until 16 November 2029. The Cilium documentation states that these certificates are not renewed automatically: a helm upgrade is needed when they approach their end. Note these dates: a link whose certificate expires stops working. The renewal is not covered here.

What limits should you know about?

They come from the Cilium 1.20 documentation as of 17 November 2026, except the first, which the demonstration shows.

  • A clustermesh-apiserver as a NodePort depends on the node that exposes it, and the CLI says so at every command. On a real cluster, the Cilium documentation indicates that a Service of type LoadBalancer, with a stable address, is generally the best option, and that a ClusterIP type requires Service addresses that are routable between the clusters.
  • Each cluster has a cluster.id between 1 and 255 by default. The documentation describes a higher limit, up to 511 with clustermesh.maxConnectedClusters=511, at the price of a lower maximum number of local identities (32767 instead of 65535). This value is set once at installation and must be identical in all clusters.
  • The egress gateway is incompatible with ClusterMesh: the exit node must be in the same cluster as the Pod.

Troubleshooting

Start with cilium clustermesh status --context <cluster> on each cluster: it says whether the mesh API is ready and whether the clusters are connected. The repair commands below are run on the node of the cluster concerned, with its admin.conf. With KUBECONFIG=~/.kube/mesh.conf, a kubectl run without --context targets the current context, so cluster-1: to act on cluster-2 from this workstation, add --context cluster-2.

SymptomLikely causeSolution
kubectl rollout status deploy/clustermesh-apiserver times out, and cilium clustermesh status answers Error: Unable to determine status: deployment clustermesh-apiserver is not ready: only 0 of 1 replicas are availableThe installation was done without clustermesh.config.enabled=true. Cause deduced from the chart (the Pod mounts the clustermesh-remote-users ConfigMap, which Helm creates only with this setting), not observed directly; the symptom itself is the exact output of the CLIOn the node of the cluster concerned: sudo helm --kubeconfig /etc/kubernetes/admin.conf upgrade cilium cilium/cilium -n kube-system --version 1.20.5 --reuse-values --set clustermesh.config.enabled=true. The clustermesh-remote-users ConfigMap appears and the rollout completes
helm install fails with Secret "cilium-ca" ... cannot be imported into the current release: invalid ownership metadatacilium-ca was copied into the cluster with kubectl apply: Helm refuses to adopt a secret it did not createOn ha-cp2: sudo kubectl --kubeconfig /etc/kubernetes/admin.conf -n kube-system delete secret cilium-ca, then pass the certificate and the key as Helm values tls.ca.cert and tls.ca.key
cilium clustermesh connect answers unable to retrieve ConfigMap "cilium-config": configmaps "cilium-config" not foundCilium is not installed in the destination cluster (the installation of cluster-2 had failed)Finish the installation of this cluster, then run connect again
cilium clustermesh status --wait prints command terminated with exit code 137 (or container not found ("kvstoremesh")) then 1 nodes are not readyThe mesh deployment is updating during the connectionWait: the command ends with All 1 nodes are connected to all clusters, within 20 to 30 seconds on 1.20.5, where the message is container not found ("kvstoremesh") instead of code 137
cilium-dbg node list only shows the nodes of the local clusterThe clusters are not connectedRead cilium clustermesh status: the No cluster connected line calls for a cilium clustermesh connect
The client never gets answers from the other clusterThe Service is not annotated in one of the clusters, or its name or namespace differsCheck that service.cilium.io/global is "true" in each cluster, and that the name and namespace are the same. Case not covered by the lab
A connection fails with a different CA or a duplicate cluster.id; overlapping Pod ranges probably break routingOne of the four preparation conditions is not metCompare cluster.id, cluster.name, the Pod ranges and the cilium-ca fingerprint on both sides. The demonstration does not provoke these failures, so these symptoms are not shown. The exact symptom of overlapping ranges is not established

Put it into practice

The lab prepares two single-node kubeadm clusters (ha-cp1 and ha-cp2), with Cilium 1.20.5 installed on both and the same certificate authority. You must link the two clusters with cilium clustermesh connect, declare the echo Service of the mesh-demo namespace global in each, then send requests from a Pod in cluster-1. The validation reads the real state: the Cilium agent of each cluster sees the node of the other in cilium-dbg node list, the service.cilium.io/global annotation is true on both sides, and twelve requests from the client get answers from both clusters.

Outside the lab, redo the walkthrough on two single-node kubeadm clusters, with your own addresses and ranges. You have succeeded when these four checks hold:

  1. The cilium-ca fingerprint is identical in both clusters, and cilium clustermesh status prints Deployment clustermesh-apiserver is ready on both sides.
  2. After cilium clustermesh connect, cilium clustermesh status --wait ends with All 1 nodes are connected to all clusters and with the 1/1 connected line for the other cluster, on each of the two clusters.
  3. cilium-dbg node list shows the node of the other cluster with the clustermesh source, and cilium-dbg service list shows one backend from each Pod range for the global Service.
  4. Twelve calls from the client give answers from both clusters; once the local Deployment is at zero, the next eight calls all come from the other cluster; once the annotation is removed, they all come from the local cluster.

When you have finished, delete the mesh-demo namespace in each cluster, the merged kubeconfig (it contains the credentials of both clusters) and the ca-valeurs.yaml file if it is still lying around, on ha-cp1, on ha-cp2 and on any machine where you copied it. If the two clusters are no longer used, destroy them too: the cilium-ca key stays readable in their secrets as long as they exist.

Terminal window
kubectl --context cluster-1 delete namespace mesh-demo
kubectl --context cluster-2 delete namespace mesh-demo
rm -f ~/.kube/mesh.conf ca-valeurs.yaml
unset KUBECONFIG

Key points

  • ClusterMesh lets each Cilium cluster see the nodes and Services of the other, without merging the clusters: each cluster keeps its control plane.
  • Linked clusters have a unique cluster.name and cluster.id, disjoint Pod ranges, nodes that reach each other by their internal address, and a common certificate authority (here cilium-ca).
  • Cilium is installed with clustermesh.useAPIServer=true and clustermesh.config.enabled=true; without the second setting, the clustermesh-apiserver Pod never becomes ready. A cilium-ca secret copied with kubectl apply makes helm install fail (invalid ownership metadata): you pass the certificate and the key as tls.ca.cert and tls.ca.key values.
  • cilium clustermesh connect --context <a> --destination-context <b> links the two clusters; cilium clustermesh status --wait and cilium-dbg node list prove it.
  • A Service is global with service.cilium.io/global: "true", set in each cluster, with the same name and the same namespace.
  • A global Service gathers the backends of both clusters and still answers when the local cluster has none left; without the annotation, the Service becomes local again.
  • The cilium-ca key passed as a Helm value is found in the cilium-ca secret and in the Helm release secrets of cluster-2 (one per revision): limit the reading of the kube-system secrets, and open port 32379 only to the nodes of the other cluster.
  • A clustermesh-apiserver as a NodePort depends on the node that exposes it. The affinity and shared annotations, and the network policies between clusters, are not covered here.

Knowledge check

Check that you have taken in the essentials of this guide. The questions cover only what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

8 questions
8 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer