개념정리/Docker & Kubernetes

Kubernetes Commands(1)

backtwobasic 2025. 1. 31. 17:26

Pod Commands

  • kubectl get pod : Get pod
  • kubectl get pod -o wide : Get pod wide information
  • kubectl get pod -w : Get pod with watch
  • kubectl get pod -o yaml : Get pod in yaml
  • kubectl edit pod <pod_name> : Edit pod
  • kubectl describe pod <pod_name> : Describe pod
  • kubectl delete pod <pod_name> : Delete pod
  • kubectl logs pod <pod_name> : Logs of the pod
  • kubectl exec -it pod <pod_name> /bin/bash : Excute into pod

 

Node Commands

  • kubectl describe node <node_name> : Describe node
  • kubectl get node -o yaml: Get node in yaml
  • kubectl get node : Get node
  • kubectl drain node : Drain node
  • kubectl cordon node : Cordon node
  • kubectl uncordon node : Uncordon node

 

Creating Objects

  • kubectl apply -f yaml : Create resource
  • kubectl apply -f .yaml -f .yaml : Create from multiple files
  • kubectl apply -f ./ : Create all files indirectory
  • kubectl apply -f https:// : Create from url
  • kubectl run -- image : Create pod
  • kubectl run -image --port --expose : Create pod, then expose it as service
  • kubectl run --image= - -dry-run=client -o yaml > .yaml : Create Pod YAML File
  • kubectl create deployment - -image= : Create Deployment
  • kubectl create deployment - -image= --dry-run=client -o yaml > .yaml : Create Deployment YAML File
  • kubectl create service --tcp= : Create Service
  • kubectl create service -- tcp= --dry-run=client -o yaml > .yaml : Create Service YAML File
  • kubectl expose deployment --type= -- port= --target-port= : Expose Service from Pod/Deployment
  • kubectl create configmap -- from-literal== --from-literal== : Create ConfigMap from Key-Value Pairs
  • kubectl create configmap -- from-file= : Create ConfigMap from File
  • kubectl create configmap --fromenv-file= : Create ConfigMap from Environment File
  • kubectl create secret generic -- from-literal== --from-literal== : Create Secret from Key-Value Pairs
  • kubectl create secret generic --fromfile= : Create Secret from File

'개념정리 > Docker & Kubernetes' 카테고리의 다른 글

Kubernetes Commands(3)  (0) 2025.01.31
Kubernetes Commands(2)  (0) 2025.01.31