This project leveraged Kubernetes Operator to help manage multiple ecns clusters
- CRD "Cluster" to store Cluster Info
- Controller
- Polling latest cluster info to update CRD
- create/delete namespaces, network policy, pod security policy
-
Precondition: you’ll need a Kubernetes cluster to run as Supervisor Cluster, and clusters to be managed.
Notes:- Make sure SuperVisor could access k8s api on managed clusters, it need add public_ip into openssl.conf and regenerate certificates
- Make sure managed clusters could access keystone on Supervisor cluster.
-
Download Code on Supervisor cluster
git clone git@github.com:es-container/cluster-management.git -
Run cluster-management
make installto install CRD
make runto run controller as process on host -
Function Demo
-
Create:
kubectl apply -f config/samples/cluster_with_host.yamlto create cluster without projects
kubectl apply -f config/samples/cluster_with_host.yamlto create cluster with projects -
Update:
kubectl edit cluster cluster-hostto update projects list -
Delete:
kubectl delete cluster cluster-hostto delete cluster
Notes:
kubctl get cluster cluster-host -o yamlto check cluster info was updated as expect. Log into managed clusters to check the namespaces(same name with projects) were created/deleted as expect.- Polling:
systemctl stop kubeletto imitate nodes NotReadykubctl get cluster cluster-host -o yamlto check cluster status was updated as expect.
-
