Skip to content

Instantly share code, notes, and snippets.

@omernaci
Created June 30, 2023 10:37
Show Gist options
  • Save omernaci/6cf699761ea5c3ee084278c7ecb84c45 to your computer and use it in GitHub Desktop.
Save omernaci/6cf699761ea5c3ee084278c7ecb84c45 to your computer and use it in GitHub Desktop.
Kubernetes Basic Command List
Description Command
Create a pod kubectl create pod <pod-name> --image=<image-name>
Get pods kubectl get pods
Describe a pod kubectl describe pod <pod-name>
Delete a pod kubectl delete pod <pod-name>
Create a deployment kubectl create deployment <deployment-name> --image=<image-name>
Get deployments kubectl get deployments
Scale a deployment kubectl scale deployment <deployment-name> --replicas=<replica-count>
Update a deployment kubectl set image deployment/<deployment-name> <container-name>=<new-image>
Delete a deployment kubectl delete deployment <deployment-name>
Create a service kubectl create service <service-type> <service-name> --tcp=<port>
Get services kubectl get services
Describe a service kubectl describe service <service-name>
Delete a service kubectl delete service <service-name>
Create a ConfigMap from a file kubectl create configmap <configmap-name> --from-file=<path-to-file>
Get ConfigMaps kubectl get configmaps
Describe a ConfigMap kubectl describe configmap <configmap-name>
Delete a ConfigMap kubectl delete configmap <configmap-name>
Create a Secret from a file kubectl create secret generic <secret-name> --from-file=<path-to-file>
Get Secrets kubectl get secrets
Describe a Secret kubectl describe secret <secret-name>
Delete a Secret kubectl delete secret <secret-name>
View pod logs kubectl logs <pod-name>
Stream pod logs kubectl logs -f <pod-name>
Execute a command in a pod kubectl exec -it <pod-name> -- <command>
Port-forward to a pod kubectl port-forward <pod-name> <host-port>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment