Core Kubernetes objects
The resource model
Section titled “The resource model”Everything in Kubernetes is a resource — a declarative record stored in etcd. You write a YAML manifest describing your desired state, apply it, and controllers work to make reality match. This applies to every object on this page.
A Pod is the smallest deployable unit. It wraps one or more containers that share a network namespace (same IP, same localhost) and can share volumes.
apiVersion: v1kind: Podmetadata: name: my-app labels: app: my-appspec: containers: - name: web image: my-registry/my-app:1.0 ports: - containerPort: 8080Deployment
Section titled “Deployment”A Deployment declares how many replicas of a Pod template should run and manages rolling updates when you change the image or config.
apiVersion: apps/v1kind: Deploymentmetadata: name: my-appspec: replicas: 2 selector: matchLabels: app: my-app template: metadata: labels: app: my-app spec: containers: - name: web image: my-registry/my-app:1.0 ports: - containerPort: 8080Key behaviors:
- Rolling update — by default, Kubernetes replaces Pods one at a time so there is no downtime.
- Rollback —
kubectl rollout undo deployment/my-appreverts to the previous revision. - Scaling —
kubectl scale deployment/my-app --replicas=4adjusts the replica count.
The Deployment creates a ReplicaSet under the hood. You interact with the Deployment; the ReplicaSet is an implementation detail.
Service
Section titled “Service”Pods get ephemeral IPs that change on restart. A Service provides a stable DNS name and IP that routes traffic to a set of Pods selected by label.
apiVersion: v1kind: Servicemetadata: name: my-appspec: selector: app: my-app ports: - port: 80 targetPort: 8080With this Service in place, other Pods in the same namespace can reach your app at http://my-app:80. The Service load-balances across all Pods matching app: my-app.
For more on Service types (ClusterIP, NodePort, LoadBalancer), see Service types.
Ingress
Section titled “Ingress”An Ingress exposes HTTP(S) routes from outside the cluster to Services inside it. It requires an Ingress controller (already running on Kestrel).
apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: my-app annotations: cert-manager.io/cluster-issuer: letsencrypt-prod traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true"spec: ingressClassName: traefik tls: - hosts: - my-app.<your-tenant>.kestrel.arbutus.cloud secretName: my-app-tls rules: - host: my-app.<your-tenant>.kestrel.arbutus.cloud http: paths: - path: / pathType: Prefix backend: service: name: my-app port: number: 80For TLS and annotation details on Kestrel, see Ingress and TLS.
How they fit together
Section titled “How they fit together” ┌─────────────────────────────┐ Internet ──▶ │ Ingress │ │ (routes external traffic) │ └──────────┬──────────────────┘ │ ┌──────────▼──────────────────┐ │ Service │ │ (stable name + load balance)│ └──────────┬──────────────────┘ │ ┌─────────────┼─────────────────┐ │ │ │ ┌────▼───┐ ┌────▼───┐ ┌────▼───┐ │ Pod (1) │ │ Pod (2) │ │ Pod (n) │ └─────────┘ └─────────┘ └─────────┘ ▲ │ Deployment (manages replicas)- The Deployment ensures the desired number of Pods are running.
- The Service gives those Pods a stable network identity.
- The Ingress maps an external hostname to the Service.
Labels and selectors
Section titled “Labels and selectors”Labels are key-value pairs on resources. Selectors filter resources by label. This is how a Service finds its Pods and how a Deployment tracks its ReplicaSet.
# On the Pod templatemetadata: labels: app: my-app tier: frontend
# On the Servicespec: selector: app: my-appNext steps
Section titled “Next steps”- kubectl basics — commands for inspecting these objects
- YAML editing patterns — common manifest patterns and gotchas