Back to exam

KCNA Cheatsheet

Kubernetes and Cloud Native Associate

Download free PDF

Kubernetes Fundamentals (44%)

Cluster architecture and reconciliation

  • **Cluster → nodes → Pods → containers** describes the execution hierarchy. Control-plane components manage cluster state; worker nodes host workloads. Both physical machines and virtual machines can be nodes.
  • **kube-apiserver** exposes the Kubernetes API and processes object requests. **etcd** persists API objects and cluster configuration; it is not an image registry or an application-data backup.
  • **kube-controller-manager** runs reconciliation loops that move actual state toward desired state. Controllers communicate through the API rather than directly editing etcd.
  • **kube-scheduler** finds unassigned Pods, filters unsuitable nodes, scores feasible nodes and binds a Pod to a node. It does not start containers or periodically move running Pods to balance load.
  • **kubelet** reconciles assigned Pod specifications on each node and calls the container runtime through CRI. **kube-proxy**, or an alternative service implementation, supplies Service forwarding rules.
  • **cloud-controller-manager** integrates with cloud infrastructure such as nodes, routes and load balancers. A pending LoadBalancer address can reflect missing integration, permissions, quota or provisioning delays.

Objects, metadata and API extensions

  • **Manifests** identify apiVersion, kind and metadata; kind-specific fields describe intent. Workload objects commonly use **spec** for desired state and **status** for observed state. YAML and JSON are serializations of API objects.
  • **Labels** are identifying key/value metadata. **Selectors** find matching objects, linking Services and workload controllers to Pods. **Annotations** store descriptive metadata that is not used by label selectors.
  • **Namespaces** scope names, permissions and quotas; they are not nested or complete security boundaries. Built-in namespaces include default, kube-system, kube-public and kube-node-lease. Nodes and PersistentVolumes are cluster-scoped.
  • **CRDs** add resource types to the API. A **custom controller** supplies reconciliation behavior; an **operator** encodes application operations using this pattern. API aggregation connects separately implemented API servers.
  • **API maturity** uses names such as v1alpha1, v1beta1 and v1. Alpha features are experimental; beta features can still change; stable APIs have stronger compatibility guarantees. Check deprecation notices before upgrading.

Pods and container roles

  • **Pod** is the smallest Kubernetes deployment and scheduling unit: one or more tightly coupled containers. Containers in a Pod share its network namespace, IP address and ports and can share explicitly mounted volumes.
  • **Init containers** normally complete sequentially before application containers start; use a shared volume to prepare files. A **sidecar** supplies ongoing helper behavior. An **ephemeral container** is added temporarily for debugging.
  • **Pods are disposable.** A workload controller can replace a failed Pod with a new UID, possibly on another node. A standalone Pod is not automatically recreated by a Deployment controller.
  • **Pod phases** are Pending, Running, Succeeded, Failed and Unknown. Pending includes scheduling and setup such as image download; Running does not mean every container is ready.
  • **restartPolicy** values are Always, OnFailure and Never. The kubelet restarts containers within the same Pod according to policy; replacing a Pod is a separate controller action.

Choose the workload controller

  • **Deployment → ReplicaSet → Pods:** use a Deployment for scalable, interchangeable application instances. Its ReplicaSets maintain replica counts; the Deployment manages rollout revisions.
  • **StatefulSet** gives Pods stable ordinal names, persistent identity and per-replica storage claims. A governing **headless Service** provides network identity. Storage persistence still depends on the configured storage system.
  • **DaemonSet** places a Pod on every eligible node, including newly added nodes. Typical uses are log collectors, monitoring agents and networking components; it is not scaled by an HPA.
  • **Job** runs work to completion. **CronJob → Job → Pods** adds a repeating cron schedule, useful for backups and batch tasks. Jobs should tolerate retries; scheduled execution is not an exactly-once guarantee.

Health checks and application readiness

  • **Liveness probe** detects a failed or stuck container and can trigger a restart. **Readiness probe** controls whether the Pod is ready to receive Service traffic; failure alone does not restart the container.
  • **Startup probe** protects slow initialization: liveness and readiness probes wait until it succeeds. After startup, liveness and readiness run independently; repeated startup failure can restart the container.
  • **Probe mechanisms** include HTTP, TCP, command execution and supported gRPC health checks. Configure thresholds and timing for the application; aggressive liveness checks can create restart loops.
  • **READY 0/1** means the one container is not ready; inspect its state and probe results. A readiness failure is one possible cause, not the only explanation.

Scheduling, requests and limits

  • **Requests** guide scheduling against node allocatable capacity. **Limits** bound container resource use through runtime and kernel mechanisms under kubelet configuration: CPU can be throttled; memory exhaustion can cause OOM termination.
  • **Resource units:** 1000m CPU equals one CPU; **500Mi** means 500 mebibytes. Memory and ephemeral-storage quantities use byte units; a lowercase m means milli, not mega.
  • If a **limit** is set without a request and admission has not supplied a default request, Kubernetes copies that limit into the request. **LimitRange** sets per-object defaults or constraints; **ResourceQuota** caps aggregate namespace usage.
  • **nodeSelector** requires matching node labels. **Node affinity** adds expressive required or preferred rules; a preferred SSD rule allows fallback to other nodes.
  • **Taints** repel Pods; matching **tolerations** permit placement but do not require it. **Pod affinity/anti-affinity** and **topology spread constraints** express relationships and spread across nodes or zones.
  • **PriorityClass** influences scheduling priority and possible preemption. It does not add capacity. Scheduling constraints, volume topology and resource requests must all be satisfiable.

Read and change cluster resources

  • **kubectl api-resources** lists available resource types; **kubectl explain deployment.spec.replicas** describes a field. **get** lists resources; **describe** shows detailed state and events.
  • **kubectl apply -f app.yaml** applies declarative intent. **kubectl run web --image=nginx** creates a Pod; **kubectl create deployment web --image=nginx --replicas=2** creates a Deployment.
  • **kubectl scale deployment/web --replicas=5 -n production** changes the desired replica count. **kubectl set image deployment/web app=example/app:v2** updates a named container in the Pod template.
  • **kubectl patch** changes selected fields; a Deployment container image belongs under spec.template.spec.containers. Updating the Pod template triggers rollout; neither patch nor apply guarantees zero downtime.
  • **kubectl rollout status deployment/web** watches progress; **rollout history** lists revisions; **rollout undo** reverts to an available earlier revision. Rollout status also supports DaemonSets and StatefulSets.

Containers, images and runtime interfaces

  • **Containers** isolate processes while normally sharing the host kernel; **virtual machines** run separate guest operating systems through a hypervisor. Linux **namespaces** isolate views; **cgroups** account for and constrain resources.
  • **Image** is a packaged filesystem and execution configuration; a **container** is a running instance. A **Dockerfile** describes image build steps, and a **registry** stores and distributes images.
  • **OCI**, the Open Container Initiative, standardizes container image, runtime and distribution formats. **runc** is a low-level OCI runtime; **containerd** and **CRI-O** provide higher-level container lifecycle services.
  • **CRI** connects kubelet to a compatible runtime; **CNI** supplies container network integration; **CSI** supplies storage integration. These interfaces solve different problems.
  • **Docker Engine** includes containerd plus developer-facing functions such as builds. Kubernetes can run OCI images without Docker Engine; a functioning CRI-compatible runtime is required on workload nodes.
  • **Kata Containers** uses lightweight VMs for stronger workload isolation; **gVisor/runsc** adds a sandboxed kernel boundary. Containers sharing a kernel should not be assumed to have VM-equivalent isolation.

Container Orchestration (28%)

Storage lifecycle and provisioning

  • **Container writable layers** are disposable. An **emptyDir** survives container restarts within its Pod but is deleted with the Pod. Use persistent storage for data that must outlive Pod replacement.
  • **PersistentVolume (PV)** represents provisioned storage; a namespaced **PersistentVolumeClaim (PVC)** requests it. A Pod references the PVC in its volumes and mounts that volume into containers.
  • **StorageClass** describes a provisioner and storage parameters. Dynamic provisioning creates a suitable volume for a claim; static provisioning uses an administrator-created PV.
  • **CSI**, the Container Storage Interface, lets storage vendors supply plugins without rebuilding Kubernetes. CSI drivers handle supported provisioning, attachment and mount operations.
  • **Retain** leaves storage for manual reclamation after release. **Delete** removes the associated provisioned storage when supported by the provisioner. The reclaim policy belongs to the PV.
  • **Volume topology** must match eligible nodes and zones. **WaitForFirstConsumer** delays binding or provisioning until scheduling context is known. **Rook** uses operators to manage storage systems such as Ceph; Ceph supports block, object and file storage.

Configuration, Secrets and workload identity

  • **ConfigMap** stores nonconfidential settings; **Secret** is intended for credentials and other sensitive values. Pods can consume them as files or environment variables. Both support immutable data objects.
  • **Base64 is encoding, not encryption.** Secret data in manifests is commonly base64-encoded; encryption at rest must be configured separately. Limit API access, protect etcd and avoid putting credentials in images or Git.
  • **ServiceAccount** provides a namespaced workload identity. Set serviceAccountName on the Pod and grant minimal RBAC permissions. If omitted, the namespace default ServiceAccount is used; it does not imply administrator access.
  • **Projected ServiceAccount tokens** support authenticated API access and expiration. Disable token automount when unnecessary. User authentication can use certificates or **OpenID Connect (OIDC)** identity tokens represented as JWTs.

Authorization and admission security

  • **Authentication** establishes identity; **authorization** decides allowed actions; **admission** can validate or mutate an authorized API request. Use least privilege rather than relying on permissive authorization settings.
  • **Role** defines namespace permissions. **ClusterRole** can define namespaced or cluster-scoped permissions. A **RoleBinding** grants permissions within its namespace, even when referencing a ClusterRole; a **ClusterRoleBinding** grants them cluster-wide.
  • **RBAC** permissions are additive: roles grant verbs on resources and do not express explicit deny rules. Bind users, groups or ServiceAccounts at the narrowest needed scope.
  • **securityContext** configures Pod or container runtime security: non-root users, dropped capabilities, seccomp and allowPrivilegeEscalation: false. NetworkPolicy does not prevent privileged container creation.
  • **Pod Security Standards:** Privileged → Baseline → Restricted. **Pod Security Admission** uses namespace labels for enforce, audit and warn modes. Restricted Linux workloads drop ALL capabilities and may add back NET_BIND_SERVICE.
  • **OPA** evaluates policy written in Rego; admission integrations can validate Kubernetes objects. **Falco** detects suspicious runtime behavior. Prevention through admission and detection during execution serve different purposes.

Image hygiene and defense in depth

  • **Multi-stage builds** leave compilers and build artifacts outside the final runtime image. Use a minimal suitable base and include only required files and packages; fewer layers alone do not ensure a smaller image.
  • **Image digests** identify immutable content; mutable tags such as latest can change. Scan dependencies and rebuild patched images. An **SBOM (Software Bill of Materials)** inventories software components.
  • **Four Cs of cloud native security:** Cloud → Cluster → Container → Code, from outer infrastructure to application logic. Apply controls at every layer; fixing one layer does not secure the others.
  • **TLS certificates** secure cluster communication and can authenticate peers. Protect private keys and plan renewal. **cert-manager** reconciles Certificate resources and writes certificate/key material to Secrets for consumers such as Ingress.

Service discovery and load balancing

  • **Service** supplies stable access to changing backend Pods, usually selected by labels. **EndpointSlices** record backend addresses, ports and readiness; they are not the API server address.
  • **ClusterIP** exposes an internal virtual IP. **NodePort** also exposes a port on nodes. **LoadBalancer** requests an external load-balancer implementation. **ExternalName** returns a DNS alias rather than proxying to selected Pods.
  • **Headless Service** sets spec.clusterIP: None and exposes backend addresses through DNS instead of a virtual IP. It is useful for direct discovery and StatefulSet identities, not a fifth Service type.
  • **CoreDNS** resolves cluster Service names. A typical name is api.default.svc.cluster.local, although the cluster domain is configurable. Regular Service names resolve to Service IPs; headless names can resolve to backend addresses.
  • **DNS and environment variables** support Service discovery. DNS handles Service changes more naturally; environment-based Service information is populated when the Pod starts.
  • **Selectorless Services** need separately managed endpoint information, typically EndpointSlices. Multi-port Services require named ports. **Load balancing** distributes requests across backend instances; it does not schedule Pods.

Pod networking, Ingress and Gateway API

  • **Pod network model** gives each Pod an IP and supports direct Pod-to-Pod communication without address translation in the cluster network. Actual reachability still depends on routing and security policies.
  • **CNI plugins** configure network connectivity, including across hosts. NetworkPolicy enforcement requires a network implementation that supports it. **Dual stack** allows IPv4 and IPv6 addresses; it does not itself translate between them.
  • **Ingress** describes HTTP(S) host/path routing to Services and requires an Ingress controller. **ingressClassName** selects an IngressClass associated with a controller; Ingress is an API resource, not a Service type.
  • **Gateway API** extends routing with clearer roles: GatewayClass defines an implementation class, Gateway defines listeners, and routes such as **HTTPRoute** attach routing rules to backends. A compatible controller must implement them.
  • **Request path:** Gateway listener → HTTPRoute rule → Service → EndpointSlice backend → Pod → container port. These objects describe routing relationships; packets do not pass through an EndpointSlice object.

Network isolation and service meshes

  • **NetworkPolicy** selects Pods and allows traffic using peers and ports. policyTypes uses **Ingress** and **Egress**. Pods are initially non-isolated in each direction until a policy isolates that direction.
  • **Policies are additive:** allowed traffic is the union of applicable rules. If both source egress and destination ingress are isolated, both sides must allow the connection. Account for DNS when restricting egress.
  • **Service mesh** adds service traffic management, security and telemetry. A **data plane** of proxies handles traffic; the **control plane** distributes configuration and policy. Mesh security complements network isolation.
  • **Istio** and **Linkerd** are service meshes; **Envoy** is a proxy used in gateways and mesh data planes. Common capabilities include mTLS, authorization, retries, timeouts and traffic splitting. **SMI** refers to the Service Mesh Interface specification.

Scale and maintain reliable capacity

  • **HPA** changes replicas of scalable targets such as Deployments and StatefulSets. Resource utilization targets depend on requests; resource metrics commonly come through metrics.k8s.io from Metrics Server.
  • **VPA** adjusts or recommends per-Pod resource requests; **Cluster Autoscaler** changes node capacity. **KEDA** connects event sources to workload scaling. Adding replicas cannot help if suitable node capacity remains unavailable.
  • **Custom metrics** can reach HPA through an adapter, such as Prometheus Adapter. Resource monitoring, custom application metrics and external event metrics use distinct APIs and integrations.
  • **Cordoning** marks a node unschedulable without evicting existing Pods: kubectl cordon worker-1. **Draining** cordons and evicts eligible Pods for maintenance; kubectl drain worker-1 --ignore-daemonsets leaves DaemonSet Pods to their controller.
  • **PodDisruptionBudget** limits simultaneous voluntary disruptions through the eviction API. It cannot prevent node failures or guarantee availability; retain enough replicas and spare capacity.
  • **High availability** combines redundant control-plane instances, load-balanced API access and etcd quorum. Three etcd members tolerate one failure; an external etcd topology separates etcd hosts from control-plane hosts.
  • **etcd consensus** requires a majority and favors low network and disk-write latency. Losing quorum prevents progress rather than allowing independent conflicting writers. Back up etcd separately from application volumes.
  • **Node controller** reacts to unreachable nodes; replacements depend on workload controllers and tolerations. **Garbage collection** follows ownership relationships, while kubelet separately reclaims unused containers and images. Jobs need appropriate cleanup policies.

Cloud Native Application Delivery (16%)

Build, integrate and release

  • **Continuous integration (CI)** frequently merges and automatically builds/tests changes. **Continuous delivery** keeps tested changes releasable with a possible approval; **continuous deployment** automatically releases qualifying changes to production.
  • **CI/CD pipelines** automate repeatable build, test, security and release steps. A pipeline improves consistency but still needs trusted artifacts, controlled credentials and meaningful checks.
  • **Infrastructure as Code (IaC)** records infrastructure intent in version-controlled definitions. Declarative reconciliation expresses the desired result rather than a fragile sequence of manual commands.
  • **Semantic versioning** uses MAJOR.MINOR.PATCH: incompatible change, compatible functionality, compatible fix. Prerelease suffixes are allowed, as in 0.1.0-rc. Kubernetes API maturity names follow a separate convention.

Rollouts and traffic promotion

  • **RollingUpdate** gradually replaces Deployment replicas and is its default strategy. Tune maxSurge, maxUnavailable and readiness; sufficient capacity and application compatibility are necessary for continuous service.
  • **Recreate** stops old replicas before starting replacements. **Blue-green** runs two environments and switches traffic; **canary** first exposes a small share of traffic to the new version.
  • **Rollback** restores an earlier workload revision or desired configuration. Kubernetes exposes rollback commands, but a failed Deployment does not universally roll itself back; data migrations require separate recovery planning.

Package and customize application manifests

  • **Helm chart** packages templates, metadata and defaults. **Chart.yaml** describes the chart, **values.yaml** supplies default settings and **templates/** generates Kubernetes resources. A **release** is an installed chart instance.
  • **helm install app ./chart -f prod.yaml** installs with overrides. **helm upgrade app ./chart --set replicaCount=3** changes a release; version-controlled values files are easier to review for substantial configuration.
  • **helm uninstall app** removes a release; **helm rollback app REVISION** restores an earlier release revision. Helm 3 **--atomic** removes a failed install or rolls back a failed upgrade; Helm 4 uses **--rollback-on-failure**. Check supported CLI flags.
  • **Kustomize** applies overlays and patches to base manifests without chart templating. **kubectl apply -k overlays/prod** applies a customization; Helm and Kustomize can both feed a GitOps workflow.

GitOps reconciliation and delivery tools

  • **GitOps** keeps declarative desired state in version control and uses automated reconciliation to detect or correct drift. Reviewable commits and rollback through Git make changes traceable.
  • **Argo CD** and **Flux** synchronize Kubernetes resources with configuration sources. Flux is built from the **GitOps Toolkit**. Image promotion and automatic sync must be configured; a new image alone does not always trigger deployment.
  • **Argo CD ApplicationSet** generates Application resources from a template and generators, such as Git or cluster generators. Targeting registered clusters requires an appropriate generator plus source and destination configuration.
  • **Argo Workflows** orchestrates containerized steps and parallel DAG-based jobs. It is a workflow engine, distinct from Argo CD delivery reconciliation. Tools such as Tekton and Jenkins X serve pipeline use cases.
  • **Manual imperative edits** can conflict with the Git source of truth and be reverted by reconciliation. Record lasting changes in the managed configuration and use controlled procedures for emergency changes.

Troubleshoot the failing layer

  • **kubectl describe pod web** reveals scheduling, volume and probe events. **ErrImagePull/ImagePullBackOff** indicate image retrieval failures: check image reference, registry access, credentials and connectivity.
  • **CrashLoopBackOff** means repeated container failures with restart backoff. Inspect exit codes, events and logs for application errors, failed probes or resource problems; it is a displayed waiting reason, not a Pod phase.
  • **kubectl logs web -c app** selects a container; add **-f** to follow output or **-p** for its previous terminated instance. Node-local Pod logs are commonly under /var/log/pods when API access is unavailable.
  • **kubectl exec web -c app -- env** inspects environment variables. Use **kubectl exec web -- nslookup api.default.svc.cluster.local** to test Service DNS if the image has the tool; an ephemeral debug container can supply missing tools.
  • **kubectl get pods -A -o wide** shows Pod placement; a spec.nodeName field selector filters one node. **kubectl port-forward service/api 8080:80** provides temporary local access for debugging.

Cloud Native Architecture (12%)

Cloud native principles and operating models

  • **Cloud native design** emphasizes resilience, operability, observability and agility through loosely coupled systems and automation. Merely putting a monolith in a container does not supply these properties.
  • **Microservices** enable independent change and scaling but introduce distributed failure modes and operational complexity. Use explicit APIs, bounded responsibilities and resilience patterns such as timeouts and circuit breakers.
  • **Orchestration** automates scheduling, rollout, health management and scaling across many containers. Image building and registry storage remain separate lifecycle capabilities.
  • **Hybrid cloud** combines public and private or on-premises environments; **multicloud** uses multiple cloud providers. Portability still requires attention to identity, networking, data and provider-specific services.
  • **Serverless** shifts infrastructure and capacity management to a platform and commonly charges by usage. **FaaS** runs event-triggered functions; servers still exist, and latency, runtime limits and state management remain design concerns.
  • **CloudEvents** standardizes event metadata for interoperability across platforms. **K3s** is a lightweight Kubernetes distribution suited to constrained and edge environments.

Community stewardship and team responsibilities

  • **CNCF** means Cloud Native Computing Foundation. It supports a vendor-neutral ecosystem of open source projects, collaboration and community events.
  • **SIGs (Special Interest Groups)** organize Kubernetes work by subject. Maintainers guide technical contributions; governance defines decision processes, responsibilities and community conduct.
  • **Open collaboration** uses public proposals, review and discussion, with voting or escalation according to project governance. No single decision mechanism applies identically to every project.
  • **KCD** means Kubernetes Community Days. Ambassadors support local communities, education and cloud native adoption; stewardship includes contributor health and project sustainability.
  • **Platform engineers** build reusable delivery and infrastructure capabilities. **SREs** apply software engineering to reliability, monitoring, incident response and automation; exact ownership depends on the organization.

Metrics, logs and traces

  • **Observability** uses system outputs to understand internal behavior. **Metrics** quantify trends, **logs** record events, and **traces** follow requests across services; dashboards alone do not explain every failure.
  • **Trace** represents an end-to-end operation; **spans** represent timed operations within it. Instrument applications and propagate trace context across service boundaries to correlate distributed work.
  • **OpenTelemetry** provides APIs, SDKs and collection/export components for telemetry. It is not itself a long-term storage and visualization backend.
  • **Prometheus** collects and queries time-series metrics, commonly by scraping targets. **Grafana** visualizes data. Log collectors such as Fluentd aggregate logs for a separate storage system.
  • **kubectl top pods** and **kubectl top nodes** show recent resource metrics when the metrics pipeline is available. Use historical monitoring for capacity trends, forecasting and alert baselines.

Metric types, reliability and cost

  • **Counter** increases or resets, such as requests_total. **Gauge** can rise or fall, such as memory usage. **Histogram** records observations in buckets; **summary** exposes count, sum and configured quantiles.
  • **PromQL** selects labeled series with braces: http_requests_total{job="apiserver"}. **rate(http_requests_total[5m])** estimates a per-second counter increase; it is not SQL.
  • **SLI** measures service behavior; **SLO** states the target; an **error budget** expresses tolerated unreliability. Alert on meaningful user impact and maintain an incident response process.
  • **FinOps** brings shared financial accountability to variable cloud spending. Track allocation, utilization and unit cost; automate visibility, forecasting and rightsizing.
  • **Bursty batch workloads** can benefit from autoscaling nodes and workload replicas, but account for startup time, constraints and completion deadlines. Cross-provider pricing and data transfer make cost optimization more complex.