⚡ OPENDEV HUB V1.0⚡ API STATUS: 100% OPERATIONAL⚡ CLIENT ENGINE: LOADED & CACHED⚡ TRENDING TECH: TAILWIND V4, NEXT.JS 16, RUST, GO⚡ ZERO AUTH REQUIRED
OPENDEVHUB

Command Palette

Search for a command to run...

KUBERNETES REFERENCE

KUBERNETES KUBECTL CHEATSHEET & DIAGNOSTICS

An offline-first search index of core Kubernetes orchestration commands, scaling parameters, service exposures, and debugging strategies.

Pod Management4 ENTRIES

kubectl get podsPod Management

List all pods in the current namespace with basic status, restarts count, and age.

SYNTAX:
kubectl get pods [flags]
EXAMPLE USAGE:
kubectl get pods -n kube-system
kubectl get pods -o wide
COMMON PITFALL:

Looking for pods in the default namespace when they are deployed in a specific namespace. Use -n <namespace> or -A to list all namespaces.

kubectl describe podPod Management

Show detailed state information of a specific pod, including lifecycle events, container states, and volumes.

SYNTAX:
kubectl describe pod <pod-name>
EXAMPLE USAGE:
kubectl describe pod my-web-app-7c569f-x12y
COMMON PITFALL:

Running kubectl describe when logs would be more useful for application errors. Describe is best for scheduling errors, ImagePullBackOff, or Evicted states.

kubectl logsPod Management

Print the logs for a container in a pod. Useful for troubleshooting startup or application run errors.

SYNTAX:
kubectl logs <pod-name> [-c <container-name>]
EXAMPLE USAGE:
kubectl logs my-web-app-7c569f-x12y -f --tail 100
COMMON PITFALL:

Forgetting to specify the container name using -c if the pod has multiple containers (e.g. sidecars or initContainers).

kubectl execPod Management

Execute a command inside a running container of a pod. Often used to open an interactive bash/sh shell.

SYNTAX:
kubectl exec -it <pod-name> [-c <container-name>] -- <command>
EXAMPLE USAGE:
kubectl exec -it my-web-app-7c569f-x12y -- /bin/sh
COMMON PITFALL:

Forgetting the double-dash '--' separator before the command, which causes kubectl to parse shell flags incorrectly.

Deployments & Scaling3 ENTRIES

kubectl scaleDeployments & Scaling

Set a new size for a deployment, replica set, or stateful set. Increases or decreases container instances.

SYNTAX:
kubectl scale --replicas=<count> deployment/<deployment-name>
EXAMPLE USAGE:
kubectl scale --replicas=5 deployment/api-server
COMMON PITFALL:

Manually scaling replicas for resources managed by a HorizontalPodAutoscaler (HPA), as HPA will overwrite your scaling adjustments immediately.

kubectl rollout statusDeployments & Scaling

Watch the progress of a deployment update (rolling restart/upgrade) until it finishes.

SYNTAX:
kubectl rollout status deployment/<deployment-name>
EXAMPLE USAGE:
kubectl rollout status deployment/api-server
COMMON PITFALL:

Running next steps in CI/CD pipeline without checking rollout status, resulting in broken deployment failures going undetected.

kubectl rollout undoDeployments & Scaling

Roll back a deployment to the previous revision, or rollback to a specific revision history number.

SYNTAX:
kubectl rollout undo deployment/<deployment-name> [--to-revision=<number>]
EXAMPLE USAGE:
kubectl rollout undo deployment/api-server --to-revision=3
COMMON PITFALL:

Rolling back without checking deployment rollout history first (via 'kubectl rollout history'), which might make you roll back to a bad state.

Service & Networking2 ENTRIES

kubectl port-forwardService & Networking

Forward one or more local ports to a pod or service. Great for debugging cluster microservices locally without exposing them.

SYNTAX:
kubectl port-forward <pod-or-service> <local-port>:<remote-port>
EXAMPLE USAGE:
kubectl port-forward svc/postgres-db 5432:5432
COMMON PITFALL:

Closing the terminal window or shell process while using port-forward, which terminates the active forwarding tunnel.

kubectl exposeService & Networking

Expose a deployment, pod, or replica set as a new Kubernetes Service, mapping internal ports to cluster IPs or load balancers.

SYNTAX:
kubectl expose deployment <deploy-name> --port=<external-port> --target-port=<container-port> --type=<ClusterIP|NodePort|LoadBalancer>
EXAMPLE USAGE:
kubectl expose deployment web-server --port=80 --target-port=8080 --type=NodePort
COMMON PITFALL:

Exposing services with target ports that do not match the port exposed by the application in the container image.

Cluster Diagnostics2 ENTRIES

kubectl topCluster Diagnostics

Display CPU and memory usage metrics for cluster nodes or pods. Requires Metrics Server to be installed in the cluster.

SYNTAX:
kubectl top <node|pod>
EXAMPLE USAGE:
kubectl top pod -n production
kubectl top node
COMMON PITFALL:

Assuming top works without Metrics Server deployed, resulting in a 'Metrics API not available' error.

kubectl cluster-infoCluster Diagnostics

Print connection and diagnostic endpoint URLs for cluster master and core addons services (DNS, dashboard).

SYNTAX:
kubectl cluster-info
EXAMPLE USAGE:
kubectl cluster-info
COMMON PITFALL:

Running commands without checking cluster-info context, causing commands to run against production instead of staging/local.

Namespace Management2 ENTRIES

kubectl create namespaceNamespace Management

Create a new namespace within the cluster to isolate resource groups.

SYNTAX:
kubectl create namespace <namespace-name>
EXAMPLE USAGE:
kubectl create namespace staging
COMMON PITFALL:

Creating namespaces manually for production apps instead of using Infrastructure as Code (IaC) manifests, which leads to configuration drift.

kubectl config set-contextNamespace Management

Change the default namespace for the current active kubectl context permanently, avoiding having to append -n every time.

SYNTAX:
kubectl config set-context --current --namespace=<namespace-name>
EXAMPLE USAGE:
kubectl config set-context --current --namespace=development
COMMON PITFALL:

Forgetting which namespace is set as default and accidentally deleting or modifying resources in the wrong namespace.

Configuration & Secrets2 ENTRIES

kubectl create configmapConfiguration & Secrets

Create a ConfigMap from literal values, files, or directories to inject non-sensitive configuration data into containers.

SYNTAX:
kubectl create configmap <config-name> --from-literal=<key>=<value> | --from-file=<path>
EXAMPLE USAGE:
kubectl create configmap app-config --from-literal=API_URL=https://api.example.com --from-file=configs/settings.json
COMMON PITFALL:

Storing sensitive information like database passwords or API keys in a ConfigMap instead of using a Kubernetes Secret resource.

kubectl create secretConfiguration & Secrets

Create a Secret resource containing sensitive information (e.g. passwords, OAuth tokens, SSH keys). Automatically Base64 encodes values.

SYNTAX:
kubectl create secret generic <secret-name> --from-literal=<key>=<value> | --from-file=<path>
EXAMPLE USAGE:
kubectl create secret generic db-credentials --from-literal=db-password=SuperSecretPass123
COMMON PITFALL:

Committing raw cleartext passwords to Git repositories inside shell commands or files used to create secrets.

Advanced Troubleshooting2 ENTRIES

kubectl cpAdvanced Troubleshooting

Copy files and directories to or from containers in a running pod. Great for pulling log files or uploading hotfixes during debug sessions.

SYNTAX:
kubectl cp <source-path> <pod-name>:<destination-path> [-c <container-name>]
kubectl cp <pod-name>:<source-path> <destination-path> [-c <container-name>]
EXAMPLE USAGE:
kubectl cp ./nginx.conf web-pod-abc-123:/etc/nginx/nginx.conf
kubectl cp web-pod-abc-123:/var/log/nginx/error.log ./error.log
COMMON PITFALL:

Using 'kubectl cp' and forgetting that the container requires the 'tar' binary installed inside it for file copies to work.

kubectl runAdvanced Troubleshooting

Create and run a temporary, interactive pod in the cluster. Highly useful for running network diagnostic tools like ping, curl, or nslookup.

SYNTAX:
kubectl run <pod-name> --image=<image-name> --rm -it -- <command>
EXAMPLE USAGE:
kubectl run dns-test --image=busybox --rm -it -- nslookup kubernetes.default.svc.cluster.local
COMMON PITFALL:

Omitting the '--rm' flag, which leaves the debugging pod in Completed/Error state in your cluster forever after you exit.

Resource Management & Lifecycle3 ENTRIES

kubectl applyResource Management & Lifecycle

Create or apply configuration changes to resources from a file or stdin using declarative YAML/JSON files.

SYNTAX:
kubectl apply -f <file-or-directory-path>
EXAMPLE USAGE:
kubectl apply -f deployments/web-app.yaml
kubectl apply -f k8s-configs/
COMMON PITFALL:

Running 'kubectl apply' without first validating configurations with 'kubectl diff' or '--dry-run=client' to verify changes.

kubectl deleteResource Management & Lifecycle

Delete Kubernetes resources by file path, resource type and name, or label selectors.

SYNTAX:
kubectl delete -f <file-path> | <resource-type> <resource-name> | -l <label-selector>
EXAMPLE USAGE:
kubectl delete -f deployments/web-app.yaml
kubectl delete pod -l app=nginx
COMMON PITFALL:

Using 'kubectl delete' on resources without checking dependencies or target namespaces, accidentally taking down critical system resources.

kubectl get eventsResource Management & Lifecycle

List events in the current namespace sorted by creation timestamp. Crucial for understanding scheduling failures, crashes, and volume issues.

SYNTAX:
kubectl get events --sort-by='.metadata.creationTimestamp'
EXAMPLE USAGE:
kubectl get events --sort-by='.metadata.creationTimestamp'
COMMON PITFALL:

Filtering through massive lists of events without sorting or restricting to a namespace, making it hard to find relevant error events.