= k8s/StudyNotes/cubectl cli commands = * cubectl Imperative commands * Create Objects * run, create, expose pod, * Update Objects * edit, scale, set image, * Using files * create -f, replace -f, delete -f * cubectl Declarative * apply -f /path/to/config-files * cubectl tips * --dry-run=client * -o yaml * Task: create yaml template for pod name Redis, with image Redis123 {{{ kubectl run redis --image=redis123 --labels=tier=db --dry-run=client -o yaml > redis.yaml # Note: add ''--expose'' & ''--port 6234'' to create service in same run }}} * After deploying !ReplicaSet rs-myapp.yml scale from current 3 to 6 {{{ kubectl scale --replicas=6 -f rs-myapp.yml }}} * Get all objects at once {{{ kubectl get all }}} * Switch away from default namespace {{{ kubectl config set-context $(kubectl config current-context) --namespace=dev }}} * Create a service to a pod (Grab selector from deployment) {{{ kubectl expose deployment simple-webapp-deployment --name=webapp-service --port=8080 --target-port=8080 --type=NodePort --dry-run -o yaml > svc.yaml }}} * cubectl apply * considers local file + LastApplied(In annotation) + Kubernetes