Sub topic 1
Why run Kubernetes locally
A local Kubernetes cluster is a real cluster that runs on your own machine and that you can delete and rebuild at will. This chapter explains what it gives you, where it falls short, and how it fits the rest of the tutorial.
Prerequisites
This chapter assumes you have:
- A comfortable working knowledge of the terminal.
- A basic understanding of containers and images.
- Some familiarity with reading YAML.
You don't need to install anything yet. The next chapter covers the container runtime and tools.
What a local cluster is
A Kubernetes cluster has a control plane, which stores state and makes scheduling decisions, and worker nodes, which run your containers. Tools such as kind and minikube create this layout on one computer. kind runs each node as a Docker container. minikube runs a node in a container or a virtual machine, depending on its driver. Either way, kubectl talks to the cluster's API server exactly as it would on a cloud cluster.
Why it is useful
- Fast feedback. You can apply a manifest, see the result and change it in seconds. You don't wait for a cloud cluster or a CI pipeline.
- Safe experiments. A mistake can't affect shared environments. If the cluster breaks, you delete it and create a new one.
- No cost. There are no cloud nodes or load balancers to pay for, and nothing to clean up in a billing console.
- Offline work. Once the images are available, you can work without a network connection.
- Realistic testing. You exercise the real Kubernetes API, so Deployments, Services, probes and RBAC rules behave as they do elsewhere. This is more faithful than a mock or a plain
docker composesetup. - Repeatable setups. A cluster created from a config file is the same for everyone on the team, and CI jobs can create it too.
Limits to keep in mind
A local cluster is not production. Knowing the differences prevents common surprises:
- Resources. Your laptop has limited CPU and memory. Many pods or a heavy workload can leave pods stuck in
Pendingor cause restarts. - Networking. There is no cloud load balancer. A Service of type
LoadBalancerstays without an external address unless you add extra tooling. You reach apps through port-forwarding, NodePorts or ingress instead. - Storage and scale. Volumes are backed by local disk, and a few nodes can't reveal problems that appear at scale.
- Cloud integrations. Cloud IAM, managed databases and provider-specific features are not available.
How this tutorial proceeds
You will install the prerequisites, create a cluster with kind and with minikube, and compare the two. You will then learn how kubectl selects a cluster, deploy and expose an app, load a locally built image, debug failures and clean up.
Exercise
Your team wants to check that a new Deployment manifest has valid probes and resource requests, and that a Service selects its pods correctly. Is a local cluster a good fit? Name one thing it would not tell you.
Show answer
Yes. A local cluster runs the real Kubernetes API, so it validates the manifest and shows whether the Service finds its pods. It would not tell you how the app performs under production load, or how a cloud LoadBalancer or cloud IAM integration behaves.