K8S_CLUSTER_CONTROL
KUBECTL_v1.30_CONNECTED01_Context_Cluster
kubectl cluster-info- État du clusterkubectl config get-contexts- Liste contexteskubectl config use-context [n]- Switch clusterkubectl config set-context --current --namespace=[n]- Set NS def.kubectl get nodes- Liste les nœudskubectl describe node [n]- Détails ressources nœudkubectl get namespaces- Liste Namespaceskubectl api-resources- Liste types ressourceskubectl version --short- Version K8s
02_Pods_Runtime
kubectl get pods- Pods NS actuelkubectl get pods -A- Tous les Namespaceskubectl get pod [p] -o wide- Avec IP et Nodekubectl run [n] --image=[i]- Lancer Pod rapidekubectl describe pod [p]- Debug events Podkubectl delete pod [p]- Suppr Podkubectl get pod [p] -o yaml- Export YAMLkubectl label pod [p] app=v1- Ajouter labelkubectl annotate pod [p] [a]- Annoter
03_Deploy_Scale
kubectl get deploy- Liste Deploymentskubectl scale deploy [d] --replicas=5- Scalerkubectl rollout status deploy [d]- Suivre MAJkubectl rollout history deploy [d]- Historiquekubectl rollout undo deploy [d]- Rollbackkubectl set image deploy [d] [c]=[i]- MAJ imagekubectl autoscale deploy [d] --min=2 --max=10- HPAkubectl get rs- Liste ReplicaSets
04_Network_Svc
kubectl get svc- Liste Serviceskubectl expose deploy [d] --port=80- Créer SVCkubectl get ingress- Liste Ingresskubectl get endpoints- Liste Endpointskubectl port-forward [p] 8080:80- Tunnel localkubectl proxy- Proxy API Serverkubectl get networkpolicy- Liste NetPol
05_Config_Storage
kubectl get cm- Liste ConfigMapskubectl get secret- Liste Secretskubectl create secret generic [n]- Créer Secretkubectl get pv- Persistent Volumeskubectl get pvc- PV Claimskubectl get storageclass- Classes de stockagekubectl edit cm [n]- Edit Live Config
06_Debug_Logs
kubectl logs [p]- Voir les logskubectl logs -f [p] -c [container]- Follow logkubectl exec -it [p] -- sh- Shell interactifkubectl top pod- Usage CPU/RAM Podskubectl top node- Usage CPU/RAM Nodeskubectl get events --sort-by=.metadata.creationTimestamp- Eventskubectl auth can-i [verb] [res]- Check RBAC
07_Advanced_Ops
kubectl apply -f [file.yaml]- Déployer YAMLkubectl diff -f [file.yaml]- Diff local/clusterkubectl patch [res] [n] -p [patch]- Patch rapidekubectl replace --force -f [f]- Re-créerkubectl cordon [node]- Marquer unschedulablekubectl drain [node]- Vider le nœudkubectl uncordon [node]- Réactiver nœudkubectl explain pod.spec- Doc interactive
08_Helm_Basics
helm install [n] [chart]- Installer Apphelm list -A- Voir toutes releaseshelm upgrade [n] [chart]- Mettre à jourhelm uninstall [n]- Suppr releasehelm repo add [n] [url]- Ajouter repohelm rollback [n] [rev]- Revenir arrièrehelm template [n] [chart]- Debug YAML
09_K8s_Power_Tools
alias k='kubectl'- Alias ultimek9s- TUI incroyable pour K8skubectx- Switch context rapidekubens- Switch namespace rapide
10_Troubleshooting_Flow
Séquence de survie :
1. kubectl get pods (Check status)
2. kubectl describe pod [n] (Check Events/Errors)
3. kubectl logs [n] --tail=100 (Check App Logs)
4. kubectl exec -it [n] -- curl localhost:port (Check Net)