Install kubectl and minikube, understand the control plane and nodes, run your first Pod, and inspect it with kubectl commands.
A Kubernetes cluster has a control plane and worker nodes. The control plane makes decisions (scheduling, scaling). Worker nodes run your containers. You interact with the control plane via kubectl.
# Install kubectl: kubernetes.io/docs/tasks/tools/
# Install minikube: minikube.sigs.k8s.io
minikube start
kubectl get nodes
# Should show one node: minikube Ready control-plane# pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
labels:
app: my-app
spec:
containers:
- name: web
image: nginx:alpine
ports:
- containerPort: 80kubectl apply -f pod.yaml
kubectl get pods
kubectl describe pod my-pod
kubectl logs my-pod
kubectl exec -it my-pod -- /bin/sh
kubectl delete pod my-pod
# Port-forward to test locally
kubectl port-forward pod/my-pod 8080:80
# Now visit http://localhost:8080kubectl talks to the control plane API.kubectl apply -f file.yaml creates/updates resources. kubectl delete -f file.yaml removes them.kubectl describe shows full resource details including events. First debugging tool.