After this lesson, you will be able to: Recognise the core Kubernetes objects: Pods, Deployments, Services, Namespaces, ConfigMaps, Secrets. Read their YAML.
Kubernetes is a vocabulary problem before it's a config problem. Learn the six core objects and 80% of K8s YAML stops being scary.
A Pod is one or more containers that share network and storage. Most Pods have ONE container; multi-container Pods are for tightly-coupled sidecars (e.g. app + log shipper). You almost never create Pods directly. You create Deployments, which create Pods. Pods get an IP inside the cluster. They're ephemeral, when a Pod dies, it's replaced with a new Pod with a new IP.
A Deployment is the K8s object you actually create. It says 'I want N copies of this Pod template running'. If a Pod dies, the Deployment makes a new one. If you change the Pod template, the Deployment does a rolling update (replace old Pods with new ones gradually). Almost every workload in K8s is a Deployment. (Other options: StatefulSets for databases, DaemonSets for per-node agents, Jobs for one-shots.)
Pods come and go; their IPs change. A Service is a stable DNS name + IP that load-balances to the Pods behind it. Service types: ClusterIP (default, internal only), NodePort (expose on every node's port), LoadBalancer (cloud LB), ExternalName (DNS alias). Inside the cluster, services are reachable by their name: `http://my-app:80`.
Namespace: a logical partition of the cluster (think 'folder'). Use namespaces to separate environments (staging vs prod) or teams. Default is `default`; system stuff lives in `kube-system`. ConfigMap: non-sensitive key/value config. Mounted into Pods as env vars or files. Secret: sensitive data (passwords, API keys). Same shape as ConfigMap but base64-encoded and treated specially. NOT encrypted at rest by default, use sealed-secrets or external secret stores for real prod.
Drop into k8s/myapp.yaml. Apply with kubectl apply -f.
apiVersion: apps/v1kind: Deploymentmetadata:name: myappnamespace: defaultspec:replicas: 3selector:matchLabels:app: myapptemplate:metadata:labels:app: myappspec:containers:- name: webimage: nginx:1.27-alpineports:- containerPort: 80resources:requests:cpu: 50mmemory: 64Milimits:cpu: 200mmemory: 128Mi---apiVersion: v1kind: Servicemetadata:name: myappnamespace: defaultspec:selector:app: myappports:- port: 80targetPort: 80type: ClusterIP
Creating Pods directly instead of Deployments. Pods don't self-heal; Deployments do. Mismatched labels between Deployment selector and Pod template labels. The Service can't find anything. Storing real secrets in Secret objects without encryption at rest. Add sealed-secrets, External Secrets Operator, or AWS Secrets Manager. Skipping resource requests/limits. K8s can't schedule effectively without them; one rogue Pod eats the whole node. Putting everything in the `default` namespace. Use namespaces from day one.
Pick the K8s mechanism.
Sign in and purchase access to unlock this lesson.