Skip to content

Instantly share code, notes, and snippets.

@begin29
Last active February 15, 2024 11:30
Show Gist options
  • Save begin29/10cc04ee252b6c42f79dd36260e64826 to your computer and use it in GitHub Desktop.
Save begin29/10cc04ee252b6c42f79dd36260e64826 to your computer and use it in GitHub Desktop.
Kubernetes cheat sheet

Kubectl run

Create an NGINX Pod

kubectl run nginx --image=nginx

Generate POD Manifest YAML file (-o yaml). Don't create it(--dry-run)

kubectl run nginx --image=nginx --dry-run=client -o yaml

Create a deployment

kubectl create deployment --image=nginx nginx

Generate Deployment YAML file (-o yaml). Don't create it(--dry-run)

kubectl create deployment --image=nginx nginx --dry-run=client -o yaml

Generate Deployment YAML file (-o yaml). Don’t create it(–dry-run) and save it to a file.

kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml

Make necessary changes to the file (for example, adding more replicas) and then create the deployment.

kubectl create -f nginx-deployment.yaml

Kubectl describe

Check pod details

kubectl describe pod pod-name-123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment