kubernetes cheat sheet

// Kubernetes Cheat Sheet

// Display Kubernetes version
kubectl version

// List all pods in the current namespace
kubectl get pods

// Describe pod details
kubectl describe pod <pod_name>

// List all services in the current namespace
kubectl get services

// Describe service details
kubectl describe service <service_name>

// List all deployments in the current namespace
kubectl get deployments

// Describe deployment details
kubectl describe deployment <deployment_name>

// List all nodes in the cluster
kubectl get nodes

// Describe node details
kubectl describe node <node_name>

// Create a new namespace
kubectl create namespace <namespace_name>

// Switch context to a different namespace
kubectl config set-context --current --namespace=<namespace_name>

// Apply configuration from a file
kubectl apply -f <filename.yaml>

// Delete a resource using its name
kubectl delete <resource_type> <resource_name>

// Scale a deployment to a specific number of replicas
kubectl scale --replicas=<number_of_replicas> deployment/<deployment_name>

// Port forward to a pod
kubectl port-forward <pod_name> <local_port>:<pod_port>

// Create a secret
kubectl create secret <secret_type> <secret_name> --from-literal=<key>=<value>

// Get logs from a pod
kubectl logs <pod_name>

// Execute a command in a pod
kubectl exec -it <pod_name> -- <command>

This cheat sheet provides commands for various Kubernetes operations in C language comments.