Перейти к основному содержимому

kubectl Cheatsheet

Before You Change Anything

These pages often point at shared systems. Confirm the cluster, namespace, and ownership boundary before running mutating commands.

Common kubectl commands for operating the Crawbl cluster.

View Logs

# Orchestrator
kubectl logs -n backend deployment/orchestrator -f

# UserSwarm webhook
kubectl logs -n backend deployment/userswarm-webhook -f

# Previous container after crash
kubectl logs -n backend <pod> --previous

Check Status

# All pods in backend
kubectl get pods -n backend

# Runtime pods
kubectl get pods -n userswarms

# All pods across namespaces
kubectl get pods -A

# Node status
kubectl get nodes

# ArgoCD applications
kubectl get applications -n argocd -o wide

Access Database

kubectl port-forward -n backend svc/backend-postgresql 5432:5432
psql -h localhost -U crawbl -d crawbl

Access ArgoCD Dashboard

kubectl port-forward svc/argocd-server -n argocd 8080:443
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d

Debug Pods

kubectl exec -it <pod-name> -n backend -- /bin/sh
kubectl describe pod <pod-name> -n backend
kubectl top pods -n backend
kubectl top nodes

Secrets And ConfigMaps

# ExternalSecrets
kubectl get externalsecret -A

# Orchestrator secret
kubectl get secret orchestrator-vault-secrets -n backend -o yaml

# ConfigMaps
kubectl get configmap -n backend -o yaml

Deployments

kubectl rollout restart deployment/orchestrator -n backend
kubectl rollout status deployment/orchestrator -n backend
kubectl rollout history deployment/orchestrator -n backend

UserSwarm Resources

# Cluster-scoped UserSwarm CRs
kubectl get userswarms

# Describe one UserSwarm
kubectl describe userswarm <name>

# Runtime pods in the shared namespace
kubectl get pods -n userswarms

# Pods for a specific swarm
kubectl get pods -n userswarms -l crawbl.ai/userswarm=<name>