To route traffic to a new backend, you must deploy a new Discoverer instance that discovers all Services and Endpoints and routes them appropriately.
-
Create a new Secret from the kubeconfig file for the cluster:
BACKEND_NAME=new-k8s SECRET_NAME=${BACKEND_NAME}-discover-kubecfg kubectl -n gimbal-discovery create secret generic ${SECRET_NAME} \ --from-file=config=./config \ --from-literal=backend-name=${BACKEND_NAME}
-
Update the deployment manifest. Set the deployment name to the name of the new backend, and set the Secret name to the name of the new Secret.
-
Apply the updated manifest to the Gimbal cluster:
kubectl -n gimbal-discovery apply -f new-k8s-discoverer.yaml
-
Verify the Discoverer is running by checking the number of available replicas in the new deployment, and by checking the logs of the new pod.
-
Ensure you have all the required credentials for the OpenStack cluster.
-
Create a new Secret:
BACKEND_NAME=new-openstack SECRET_NAME=${BACKEND_NAME}-discover-openstack kubectl -n gimbal-discovery create secret generic ${SECRET_NAME} \ --from-file=certificate-authority-data=${CA_DATA_FILE} \ --from-literal=backend-name=${BACKEND_NAME} \ --from-literal=username=${OS_USERNAME} \ --from-literal=password=${OS_PASSWORD} \ --from-literal=auth-url=${OS_AUTH_URL} \ --from-literal=tenant-name=${OS_TENANT_NAME}
-
Update the deployment manifest. Set the deployment name to the name of the new backend, and update the secret name to the one created in the previous step.
-
Apply the updated manifest to the Gimbal cluster:
kubectl -n gimbal-discovery apply -f new-openstack-discoverer.yaml
-
Verify the Discoverer is running by checking the number of available replicas in the new deployment, and by verifying the logs of the new pod.
To remove a backend from the Gimbal cluster, the Discoverer and the discovered services must be deleted.
-
Find the Discoverer instance that's responsible for the backend:
# Assuming a Kubernetes backend kubectl -n gimbal-discovery get deployments -l app=kubernetes-discoverer
-
Delete the instance:
kubectl -n gimbal-discovery delete deployment ${DISCOVERER_NAME}
-
Delete the Secret that holds the credentials for the backend cluster:
kubectl -n gimbal-discovery delete secret ${DISCOVERER_SECRET_NAME}
Warning: Performing this operation results in Gimbal not sending traffic to this backend.
-
List the Services that belong to the cluster, and verify the list:
kubectl --all-namespaces get svc -l gimbal.projectcontour.io/backend=${CLUSTER_NAME}
-
List the namespaces with Services that were discovered:
kubectl get svc --all-namespaces -l gimbal.projectcontour.io/backend=${CLUSTER_NAME} -o jsonpath='{range .items[*]}{.metadata.namespace}{"\n"}{end}' | uniq
-
Iterate over the namespaces and delete all Services and Endpoints:
NAMESPACES=$(kubectl get svc --all-namespaces -l gimbal.projectcontour.io/backend=${CLUSTER_NAME} -o jsonpath='{range .items[*]}{.metadata.namespace}{"\n"}{end}' | uniq) for ns in $NAMESPACES do kubectl -n $ns delete svc,endpoints -l gimbal.projectcontour.io/backend=${CLUSTER_NAME} done