[Kubernetes (K8S)] Helm install AppCode Kubed to sync ConfigMaps/Secrets across Kubernetes (K8S) namespaces or Clusters
helm-AppsCode-kubed-example
AppsCode Kubed
Kubed by AppsCode is a Kubernetes cluster manager daemon that can sync ConfigMaps/Secrets across Kubernetes namespaces or Clusters.
This article is about how to use Helm to install kubed on Kubernetes (K8S).
Prerequisites
-
Kubernetes (K8S)
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.For more information about installing and using Kubernetes (K8s), see the Kubernetes (K8s) Docs.
-
Helm
Helm is the best way to find, share, and use software built for Kubernetes.For more information about installing and using Helm, see the Helm Docs.
How to Install
Helm install kubed into kube-system namespace.
1 | Add the Stable Helm repository: |
See Helm release about kubed
1 | helm list --namespace kube-system |
See pods about kubed.
1 | kubectl get pods -n kube-system |
Custom Values.yaml
1 | # kubed/values.yaml at v0.12.0 · appscode/kubed |
Synchronize ConfigMap or Secret
Synchronize ConfigMap
First, create a NameSpace called demo.
1 | kubectl create namespace demo |
Now, create a ConfigMap called omni in the demo namespace. This will be our source ConfigMap.
1 | # cat demo-0.yaml |
Apply the demo-0.yaml to create ConfigMap.
1 | kubectl apply -f demo-0.yaml |
Now, apply the kubed.appscode.com/sync: “” annotation to ConfigMap omni. Kubed operator will notice that and copy the ConfigMap in all namespaces.
1 | kubectl annotate configmap omni kubed.appscode.com/sync="" -n demo |
Namespace Selector
Lets’ change annotation value of source ConfigMap omni.
1 | kubectl annotate configmap omni kubed.appscode.com/sync="app=kubed" -n demo --overwrite |
Kubed operator removes the ConfigMap from all namespaces (except source) since no namespace matches the label-selector app=kubed. Now, lets’ apply app=kubed annotation to other namespace. Kubed operator will then sync the ConfigMap to other namespace.
1 | kubectl label namespace other app=kubed |
Restricting Source Namespace
By default, Kubed will watch all namespaces for configmaps and secrets with kubed.appscode.com/sync annotation. But you can restrict the source namespace for configmaps and secrets by passing config.configSourceNamespace value during installation.
1 | helm install kubed appscode/kubed \ |
References
[1] appscode/kubed: 🛡️ A Kubernetes Cluster Daemon - https://github.com/appscode/kubed
[2] Kubed by AppsCode - https://appscode.com/products/kubed/v0.12.0/guides/config-syncer/
[3] Kubed by AppsCode - https://appscode.com/products/kubed/v0.12.0/guides/config-syncer/intra-cluster/