// Kubernetes development and operations best practices. USE WHEN working with kubectl commands, K8s manifests, deployments, debugging pods, managing resources, RBAC, or cluster operations.
| name | Kubernetes |
| description | Kubernetes development and operations best practices. USE WHEN working with kubectl commands, K8s manifests, deployments, debugging pods, managing resources, RBAC, or cluster operations. |
Expert guidance on Kubernetes operations, kubectl command-line usage, and cloud-native development best practices.
This skill activates when:
.yaml or .yml files with kind:, apiVersion:)kubectl, helm, or k9s are mentionedWhen executing a workflow, output this notification directly:
Running the **WorkflowName** workflow from the **Kubernetes** skill...
| Workflow | Trigger | File |
|---|---|---|
| Debug | "debug pod", "troubleshoot", "pod logs", "pod errors" | workflows/Debug.md |
| Deploy | "deploy", "apply manifests", "rollout", "update deployment" | workflows/Deploy.md |
| Context | "kubectl context", "namespace", "switch cluster" | workflows/Context.md |
| Resources | "create resource", "manifest", "yaml", "configmap", "secret" | workflows/Resources.md |
| Security | "RBAC", "pod security", "network policy", "security best practices" | workflows/Security.md |
| Scaling | "scale deployment", "HPA", "autoscaling", "replicas" | workflows/Scaling.md |
alias k=kubectl
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
alias kgd='kubectl get deployments'
alias kgn='kubectl get nodes'
alias kdp='kubectl describe pod'
alias kdd='kubectl describe deployment'
alias kl='kubectl logs'
alias kx='kubectl exec -it'
alias kaf='kubectl apply -f'
alias kdel='kubectl delete'
Get resources with custom output:
kubectl get pods -o wide
kubectl get pods -o yaml
kubectl get pods -o json | jq '.items[].metadata.name'
kubectl get pods --sort-by=.metadata.creationTimestamp
Watch resources:
kubectl get pods -w
kubectl get events -w
Context and namespace:
kubectl config get-contexts
kubectl config use-context <context>
kubectl config set-context --current --namespace=<namespace>
Always specify:
Example deployment manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
version: v1.0.0
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
version: v1.0.0
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: myapp
image: myapp:v1.0.0
ports:
- containerPort: 8080
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir: {}
metadata:
labels:
app.kubernetes.io/name: myapp
app.kubernetes.io/instance: myapp-prod
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/component: backend
app.kubernetes.io/part-of: myplatform
app.kubernetes.io/managed-by: kubectl
:latest tag - Always use specific version tagskubectl apply --dry-run=clientkubectl get podskubectl describe pod <pod-name>kubectl logs <pod-name> [-c <container>]kubectl logs <pod-name> --previouskubectl exec -it <pod-name> -- /bin/shkubectl get events --sort-by=.metadata.creationTimestampkubectl port-forward pod/<pod-name> 8080:8080Example 1: Debug failing pod
User: "My pod is in CrashLoopBackOff, help me debug it"
→ Invokes Debug workflow
→ Checks pod status and events
→ Reviews logs for errors
→ Validates resource definitions
→ Identifies root cause and suggests fix
Example 2: Deploy application
User: "Deploy my application to Kubernetes with best practices"
→ Invokes Deploy workflow
→ Creates manifest with security contexts
→ Adds health probes and resource limits
→ Validates with dry-run
→ Applies and monitors rollout
Example 3: Set up RBAC
User: "Create RBAC for my application with minimal permissions"
→ Invokes Security workflow
→ Creates ServiceAccount
→ Defines Role with specific permissions
→ Creates RoleBinding
→ Tests permissions
This skill integrates with: