Skip to main content

Kubernetes & GKE

Exam guide§2.1

Kubernetes is the open-source container orchestrator; GKE is Google's managed version of it. Know what Kubernetes itself is - the vocabulary (cluster, node, control plane) and the declarative vs imperative distinction - before the GKE specifics: operating modes, cluster shapes, and the core objects.

What Kubernetes is

Kubernetes is an open-source platform for managing containerized workloads and services. It orchestrates many containers across many hosts, scales them as microservices, and handles rollouts and rollbacks.

At the highest level it is a set of APIs you use to deploy containers onto a set of nodes called a cluster. A cluster splits into:

  • Control plane - the primary components that run the cluster (the "brain").
  • Nodes - the machines that actually run your containers.

You describe a set of applications and how they should interact, and Kubernetes works out how to make that happen.

GotchaA Kubernetes "node" is not a GCP "node"

In Kubernetes a node is a computing instance (a machine) that runs containers. That is different from how "node" is sometimes used on Google Cloud, where the underlying machine is a Compute Engine virtual machine. On GKE each Kubernetes node is a Compute Engine VM, but keep the k8s term (a cluster member that runs pods) straight from the generic GCP usage.

Declarative vs imperative configuration

This is the concept the exam tests most. Kubernetes supports both, but they are not equal in practice.

  • Declarative - you describe the desired state you want, not the steps to get there. Kubernetes continuously makes the deployed system conform to that state and keeps it there in spite of failures. The desired state is always documented, so it saves work and reduces the risk of error.
  • Imperative - you issue commands to change the system's state directly.
KubernetesDeclarative configurationDesired stateKubernetesImperative configurationDeclared state
Declarative: describe the desired state and Kubernetes maintains it. Imperative: issue commands to change state directly.
DECISIONDeclarative or imperative?
Define and maintain a system's desired stateDeclarative
Self-healing / conforms after failuresDeclarative
Quick, temporary fixImperative
Exploring while building a declarative configImperative
Pick this when: declarative by default; imperative only for quick temporary fixes
GotchaImperative is only for quick fixes

One of Kubernetes' primary strengths is automatically keeping a system in the state you declare. Experienced administrators use imperative configuration only for quick temporary fixes and as a tool while building a declarative configuration - never as the way to run a system long-term.

Features

FactsWhat Kubernetes gives you
  • Workload types - stateless apps (Nginx, Apache), stateful apps (user/session data persisted), batch jobs, and daemon tasks.
  • Autoscaling - scales containerized apps in and out based on resource utilization.
  • Resource controls - you set resource requests and limits per workload; this improves overall workload performance within a cluster.
  • Extensible - a rich ecosystem of plugins and add-ons; Custom Resource Definitions (CRDs) let you define new resource types Kubernetes can manage.
  • Portable - open-source, runs anywhere (on-premises or another cloud), so workloads move freely with no vendor lock-in.

How this section is organized

Build the mental model in this order:

  1. Containers and virtualization - what a container is and why it beats a VM per app.
  2. Container images - how images are layered, built, and stored.
  3. Object model - what you declare: objects (spec vs status), manifests, Pods, controllers, the watch loop.
  4. Cluster architecture - the machine that honors it: control-plane and node components.
  5. GKE: managed Kubernetes - Google's managed layer: operating modes, cluster shapes, node pools, scaling, automation, integrations.
  6. The kubectl command - how a command reaches the cluster, kubeconfig, syntax.
  7. Introspection - get / describe / exec / logs.
  8. Working with clusters - the full hands-on connect → deploy → expose → introspect workflow.