liveBook · Manning

Autopilot mode

As explained in Kubernetes for Developers

Autopilot mode is a Google Kubernetes Engine operating mode that automatically provisions, scales, repairs, and upgrades cluster compute capacity.

A Pod that cannot be scheduled because there is insufficient CPU may need more node capacity. GKE Autopilot reduces that operational work: you specify what your Kubernetes workloads need, and Autopilot provisions and manages the compute capacity to run their Pods. section 6.1

For a Deployment, StatefulSet, or Job, specify the desired replicas and each Pod’s CPU and memory requirements. You do not have to define those requirements again by choosing and managing nodes. Autopilot does not hide nodes entirely: scheduling controls such as affinity and spread topologies remain relevant when placement matters. section 6.1

Listing 6.1 Chapter06/6.1_Replicas/deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: timeserver
spec:
  replicas: 6       #1
  selector:
    matchLabels:
      pod: timeserver-pod
  template:
    metadata:
      labels:
        pod: timeserver-pod
    spec:
      containers:
      - name: timeserver-container
        image: docker.io/wdenniss/timeserver:3
        resources:
          requests:
            cpu: 200m
            memory: 250Mi
#1 The replicas field specifies how many copies of your Pod you want to be running.

This Deployment requests six replicas, with 200m CPU and 250Mi memory for each Pod—the workload information Autopilot uses to provision capacity. section 6.1

To create an Autopilot cluster in GKE, choose a name and region; the networking and advanced settings can stay at their defaults. Alternatively, create it with the gcloud CLI. Afterward, get the cluster credentials so kubectl can access its Kubernetes API. section 3.2.1

CLUSTER_NAME=my-cluster
REGION=us-west1
gcloud container clusters create-auto $CLUSTER_NAME --region $REGION
gcloud container clusters get-credentials $CLUSTER_NAME --region $REGION

These commands create an Autopilot cluster in a chosen region and then configure access to it. section 3.2.1

How Kubernetes for Developers covers it

How deep it goes
Explains cluster creation, workload resource requirements, and retained scheduling controls without detailing Autopilot’s internal provisioning mechanism.
Examples
Uses an Autopilot cluster-creation command and a six-replica Deployment requesting 200m CPU and 250Mi memory per Pod.
What it assumes
Requires a Google Account and billing or trial access for the GKE example; introduces the needed gcloud and kubectl setup.
What you can do after
Operate/configure it by creating a GKE Autopilot cluster and supplying replica counts and resource requests for workloads.
How it connects
Links Pod resource requests and replica counts to node capacity, scheduling, affinity, and spread topologies.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.