🦈Kubernetes

Pod Management

# List all pods in the default namespace
kubectl get pods

# Display logs for a specific pod and container
kubectl logs <pod-name> -c <container-name>

# Execute an interactive shell in a specific pod and container
kubectl exec -it <pod-name> -c <container-name> -- /bin/sh

Configuration Management

# List all ConfigMaps in the default namespace
kubectl get configmaps

Namespace Management

# List all namespaces
kubectl get namespaces

# Switch to a different namespace
kubectl config set-context --current --namespace=<namespace-name>

Last updated