kubectl is the command-line client for working with a Kubernetes cluster. Before deploying anything, connect and authenticate it to a cluster. That cluster can be hosted by a cloud provider or run locally. A simple check is `kubectl get pods`; an empty result can still mean the connection works. section 3.2.1
Use kubectl to create, read, update, and delete Kubernetes objects. The main commands are `create`, `get`, `apply`, and `delete`. A practical workflow is to describe a Deployment or Service in a YAML file, then submit that file rather than relying on one-off commands. The same configuration can be tried against a local cluster before being used elsewhere. section 3.2.5 section 3.4.3
Common tasks:
- Create a Service from a file with `kubectl create -f service.yaml`, then inspect it with `kubectl get service`. Add `-w` to watch for changes, such as an external IP becoming available. section 3.2.5
- After changing a Deployment’s container image in YAML, run `kubectl apply -f deploy.yaml`. Check `kubectl get deploy` to follow the update; Kubernetes replaces the old Pods rather than requiring you to replace them manually. section 3.2.7
- Use `kubectl config get-contexts` and `kubectl config use-context $CONTEXT` to inspect and switch between previously connected clusters. section 3.4.1
- Use `kubectl port-forward service/timeserver 8080:80` to reach a Service at `localhost:8080`, particularly when a local cluster has no external load balancer. section 3.4.3
Check an application update
Suppose a Deployment requests three Pods and its image changes from version 1 to version 2. After `kubectl apply -f deploy.yaml`, `kubectl get deploy` might show READY as `3/3` but UP-TO-DATE as `1`. The update is still underway; watch the Deployment or inspect its Pods until the current-version count catches up. section 3.2.7










