- tenant IPs are stored in
ips.txt - These are used to create the number of services and the number of replicas for a statefulset (1 tenantip = 1 pod)
- Running
./update-service.sh afor the first time will create the services - The files
ips.txtcontains the list of clusterIPs to set, which also creates a label and selector - Passing an
aorbwill update the selector to use the pods in groupaorb
- Create statefulsets
- Increase replicas for active set using
patch- replicas are the number of tenatips in
ips.txt
- replicas are the number of tenatips in
- For a/b deployment
- Increaes replicas for inactive set using
patch - Update labels for inactive group (see next step)
- Update service selector to use
group=${activegroup}
- Increaes replicas for inactive set using
- Pods in a statefulset/deployment are applied labels, but not individual labsl which will allow for specific tenantIP data loading
- Deploy the statefulset first, and it will go into "init running" while it waits for a
tenantiplabel to be applied - The
update-labels.shscript will read the IPs inips.txtand apply a label to each pod with each one
- Deploy service with activegroup a
./udpate-service.sh akubectl apply -f service.yaml - Deploy statefulset, by default they are set to 0
kubectl apply -f ./statefulSet.yaml - scale up active statefulset to match the number of ips in
ips.txtgroup=a; replicas=$(wc -l ./ips.txt | awk {'print $1'}); kubectl patch statefulsets analytics-server-${group} -p "{\"spec\":{\"replicas\":${replicas}}}" - Update the running statefulset to read the
ips.txtand apply a tenantIP to use for group a./update-labels.sh a - Pods will go from
InittoRunningand viewing the labels on the pod will show each one has a unique clusterIPs - Verify services are going to correct pods
kubectl get svc`kubectl describe svc analytics-server-172-20-123-221 | grep Endpoints`` - This will show that the Endopint is going to the pod with labels group=a and the tenantip=${clusterIP}