Federation v1is strongly discouraged.
Federation V1never achieved GA status and is no longer under active development. Documentation is for historical purposes only.
For more information, see the intended replacement, Kubernetes Federation v2.
This guide explains how to use ConfigMaps in a Federation control plane.
Federated ConfigMaps are very similar to the traditional Kubernetes ConfigMaps and provide the same functionality. Creating them in the federation control plane ensures that they are synchronized across all the clusters in federation.
- Before you begin
- Creating a Federated ConfigMap
- Updating a Federated ConfigMap
- Deleting a Federated ConfigMap
Before you begin
This guide assumes that you have a running Kubernetes Cluster Federation installation. If not, then head over to the federation admin guide to learn how to bring up a cluster federation (or have your cluster administrator do this for you). Other tutorials, such as Kelsey Hightower’s Federated Kubernetes Tutorial, might also help you create a Federated Kubernetes cluster.
Creating a Federated ConfigMap
The API for Federated ConfigMap is 100% compatible with the API for traditional Kubernetes ConfigMap. You can create a ConfigMap by sending a request to the federation apiserver.
You can do that using kubectl by running:
kubectl --context=federation-cluster create -f myconfigmap.yaml
--context=federation-cluster flag tells kubectl to submit the
request to the Federation apiserver instead of sending it to a Kubernetes
Once a Federated ConfigMap is created, the federation control plane will create a matching ConfigMap in all underlying Kubernetes clusters. You can verify this by checking each of the underlying clusters, for example:
kubectl --context=gce-asia-east1a get configmap myconfigmap
The above assumes that you have a context named ‘gce-asia-east1a’ configured in your client for your cluster in that zone.
These ConfigMaps in underlying clusters will match the Federated ConfigMap.
Updating a Federated ConfigMap
You can update a Federated ConfigMap as you would update a Kubernetes ConfigMap; however, for a Federated ConfigMap, you must send the request to the federation apiserver instead of sending it to a specific Kubernetes cluster. The federation control plane ensures that whenever the Federated ConfigMap is updated, it updates the corresponding ConfigMaps in all underlying clusters to match it.
Deleting a Federated ConfigMap
You can delete a Federated ConfigMap as you would delete a Kubernetes ConfigMap; however, for a Federated ConfigMap, you must send the request to the federation apiserver instead of sending it to a specific Kubernetes cluster.
For example, you can do that using kubectl by running:
kubectl --context=federation-cluster delete configmap
Note: Deleting a Federated ConfigMap does not delete the corresponding ConfigMaps from underlying clusters. You must delete the underlying ConfigMaps manually.
Was this page helpful?
Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on Stack Overflow. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.