EKS Cluster#
An EKS cluster has two halves:
- The control plane: the Kubernetes API server, etcd, scheduler, and controllers. AWS runs these for you, patches them, and keeps them highly available. You never SSH into it; you just get an API endpoint and a
kubeconfig. - The data plane: the worker nodes (EC2 instances) or Fargate tasks that actually run your pods. These live in your VPC, in the subnets you choose.
For the worker nodes we’ll use a managed node group: AWS creates the EC2 instances from a launch template, joins them to the cluster, and can roll updates for us. (Fargate is the serverless alternative - no nodes to think about, but less control and a different cost model.)
We’ll build the cluster with eksctl, the official CLI from the EKS team. Doing the same thing by clicking through the console takes about forty steps; eksctl takes one command.
Assignment#
Create an EKS cluster named patientping-eks with a small managed node group in the patientping VPC’s private subnets.
Cost check: The EKS control plane costs about $0.10 per hour (~$73/month) from the moment the cluster is Active. The t3.small worker node adds a few dollars per month on top. This is the most expensive lesson in the whole document - delete the cluster when you’re done.
Install
eksctlif you don’t have it (see the official instructions), and make sure your AWS CLI credentials are thealperen-adminuser, not the root user.Write the cluster config to a file called
patientping-eks.yaml:
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: patientping-eks
region: us-east-1
vpc:
id: "vpc-REPLACE_WITH_YOUR_VPC_ID"
clusterEndpoints:
publicAccess: true
privateAccess: true
subnets:
private:
us-east-1a: { id: "subnet-PRIVATE_A_ID" }
us-east-1b: { id: "subnet-PRIVATE_B_ID" }
managedNodeGroups:
- name: patientping-workers
instanceType: t3.small
desiredCapacity: 2
privateNetworking: trueThe VPC and subnet IDs are the ones from the Networking section - the same
patientpingVPC wherepatientping-db(RDS) lives. Keeping the nodes in private subnets means they don’t get public IPs; they reach the internet through the NAT gateway.
- Create the cluster:
eksctl create cluster -f patientping-eks.yamlThis takes roughly 10-15 minutes. eksctl provisions the control plane, creates a security group, writes the kubeconfig entry for you, and joins the two worker nodes.
- Verify the cluster:
kubectl get nodesYou should see two nodes in Ready state (it can take a minute after the command finishes for them to join).
kubectl get svcThe kubernetes service in default should point at your new API endpoint.
Trouble?
eksctl utils write-kubeconfig --cluster patientping-eksrefreshes yourkubeconfig, andaws eks update-kubeconfig --name patientping-eksdoes the same thing with the AWS CLI.
That’s it - you now have a real Kubernetes cluster. The rest of this section is just Kubernetes: manifests, secrets, and wiring up AWS services to it.