How can I restart a pod?

If you pod is not responding or needs a restart the way to do it is to use the following command. This will delete the pod and replace it with a new pod if it is a part of a deployment.

kubectl delete pod <pod-name>

How can we remove pods?

This has to be done through the deployment in the helm chart. Another way to do it is to scale down

kubectl scale --replicas=0 -n <namespace> deployment/<deploymentname>

How can I add pods?

This has to be done through the deployment in the helm chart.

How can I add nodes?

Nodes are added through the Terraform module variable. Please check the infrastructure code and where the modules are defined. These will create the scaling groups for nodes.

How can I remove nodes?

Nodes are added through the Terraform module variable. Please check the infrastructure code and where the modules are defined. These will create the scaling groups for nodes.

How can I restart nodes?

Nodes can be terminated using the following script:

export aws_profile=profile_name

for i in $(kubectl get nodes | awk '{print $1}' | grep -v NAME)
do
        kubectl drain --ignore-daemonsets --grace-period=60 --timeout=30s --force $i
        aws --profile $aws_profile ec2 terminate-instances --instance-ids $(aws --profile $aws_profile ec2 describe-instances --filter "Name=private-dns-name,Values=$i" | jq -r '.Reservations[].Instances[].InstanceId')
        sleep 300 # Wait 5 mins for the new machine to come back up
done