- 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 a
for the first time will create the services - The files
ips.txt
contains the list of clusterIPs to set, which also creates a label and selector - Passing an
a
orb
will update the selector to use the pods in groupa
orb
- 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
tenantip
label to be applied - The
update-labels.sh
script will read the IPs inips.txt
and apply a label to each pod with each one
- Deploy service with activegroup a
./udpate-service.sh a
kubectl 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.txt
group=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.txt
and apply a tenantIP to use for group a./update-labels.sh a
- Pods will go from
Init
toRunning
and 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}