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
