Cloud Native Cheatsheet

Essential commands for Kubernetes, Docker, AWS, Terraform, and Helm. Keep your cloud-native development workflow efficient.

Kubernetes Basics

kubectl get pods

List all pods in the current namespace

kubectl get pods -A

List pods in all namespaces

kubectl describe pod <pod-name>

Show detailed information about a pod

kubectl logs <pod-name>

View pod logs

kubectl exec -it <pod-name> -- /bin/bash

Get an interactive shell in a pod

kubectl apply -f <file>

Apply a configuration file

kubectl delete -f <file>

Delete resources defined in a file

Kubernetes Advanced

kubectl port-forward <pod-name> <local-port>:<pod-port>

Forward a local port to a pod

kubectl scale deployment <deployment-name> --replicas=<number>

Scale a deployment

kubectl rollout status deployment/<deployment-name>

Check deployment rollout status

kubectl rollout undo deployment/<deployment-name>

Rollback a deployment

kubectl get events --sort-by='.lastTimestamp'

View cluster events sorted by time

kubectl top nodes

Show resource usage of nodes

kubectl top pods

Show resource usage of pods

Docker Commands

docker build -t <image-name> .

Build a Docker image

docker run -d -p <host-port>:<container-port> <image-name>

Run a container in detached mode with port mapping

docker ps -a

List all containers (including stopped)

docker logs <container-id>

View container logs

docker exec -it <container-id> /bin/bash

Get an interactive shell in a container

docker-compose up -d

Start services in detached mode

docker system prune -a

Remove all unused containers, networks, images

AWS CLI

aws configure

Configure AWS credentials

aws s3 ls

List S3 buckets

aws ec2 describe-instances

List EC2 instances

aws eks list-clusters

List EKS clusters

aws rds describe-db-instances

List RDS instances

aws cloudformation list-stacks

List CloudFormation stacks

aws iam list-users

List IAM users

Terraform

terraform init

Initialize a Terraform working directory

terraform plan

Show execution plan

terraform apply

Apply changes to infrastructure

terraform destroy

Destroy infrastructure

terraform state list

List resources in state

terraform import <resource> <id>

Import existing infrastructure

terraform output

Show output values

Helm

helm repo add <name> <url>

Add a chart repository

helm repo update

Update chart repositories

helm install <release-name> <chart>

Install a chart

helm list

List releases

helm upgrade <release-name> <chart>

Upgrade a release

helm rollback <release-name> <revision>

Rollback a release

helm uninstall <release-name>

Uninstall a release