Skip to content

Kubernetes

Pod

Enter pod:

POD=name-of-pod
kubectl exec --stdin --tty $POD -- /bin/bash

Troubleshooting

kubectl describe deploy $DEPLOYMENT
kubectl get deploy $DEPLOYMENT
kubectl get pod $POD

Sorting

kubectl get pods --sort-by=.metadata.creationTimestamp
kubectl get pods -lapp=$POD --sort-by=.metadata.creationTimestamp

Scale down no of replicas

kubectl get deployments
kubectl scale --replicas=1 deployments/<my-microservice>

Cron jobs

kubectl get cj

Manual run

$ kubectl get cj | grep <my-name>

some-cronjob-name                           10 * * * *     False     1        10m             3h2m
$ kubectl create job --from=cronjob/some-cronjob-name fredrik-manual-test-1

Suspension of cronjob

Suspension was done but when we wanted to resume it, it didn’t work. Turns out we had to remove the old one and re-deploy (for every cluster).

kubectl delete cj/some-cronjob-name