GAP Documentation
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Common commands

Display list of contexts and show the currently selected

kubectl config get-contexts -n=my-namespace

Scale a deployment named my-deployments-name to number-of-replicas

It is useful to restart pods. (Short downtime is possible)

kubectl scale deployments/my-deployments-name --replicas=number-of-replicas -n=my-namespace

Rolling restart of the deployment

It is useful to restart pods. (No downtime)

kubectl rollout restart deployment/my-deployments-name -n=my-namespace

List all pods in my-namespace

kubectl get pods -n=my-namespace

Run command in existing pod

Useful to get shell for the pod. (In this case my-command is bash)

kubectl exec -it -n=my-namespace my-pod-name my-command

List all jobs in my-namespace

kubectl get jobs -n=my-namespace

Run a job

The unique-job-name will be visible on the web UI, you can delete it from here. An alternative solution is to run the job from web UI.

kubectl create job unique-job-name --from=cronjob/my-cron-job-name

Get the logs of all pods of a certain deployment

kubectl logs -n=my-namespace -l app=myapp-web

Get the logs of all object of an application

kubectl logs -n=my-namespace -l applicationName=myapp