This is pure education 🏫
It's a bunch of stuff automating this in AWS: https://github.com/kelseyhightower/kubernetes-the-hard-way/
Assuming you are starting from absolute scratch:
-
Ensure Ansible is installed:
sudo yum install ansible -y
-
Get an AWS account. Generate the access token secrets (there's 2) and put them in
skate
:skate set aws_access_key YOUR_KEY skate set aws_access_key_secret YOUR_SECRET
-
Configure machine with required tools, like the AWS CLI,
kubectl
, Terraform:ansible-playbook setup.yml
-
Install the base infrastructure in AWS to host a Kubernetes cluster:
terraform plan -target aws_instance.worker terraform apply -target aws_instance.worker terraform apply
-
Checkpoint! Confirm things are working so far:
ansible aws_ec2 -m ping
-
Generate certs, kubeconfigs, and encryption config:
bash generate.sh
-
Provision the compute instances.
ansible-playbook provision.yml
- Provide generated cert/config files
- To persist cluster state data, bootstrap the key-value store
etcd
. - Install and configure Control Plane components:
kube-apiserver
: Handle API request in/out of the control planekube-controller-manager
: Manage all control loops, the things that watch and converge statekube-scheduler
: Control Pod deployment to Nodeskubectl
: CLI to interact with Kube API
- Setup RBAC for API Server to Kubelet communication
- Install and configure Node components:
kubelet
: Agent that manages Podskube-proxy
: Network proxy, which helps turn the node into a Service-friendly HTTP participant on a networkrunc
: Low level tool to manage OCI imagescontainerd
: High level tool to manage OCI imagesCNI
: Container networking plugins. They configure networking inside containerskubectl
kubectl
remote admin accesscoredns
deployment to cluster for DNS support
-
Smoke test the cluster
bash smoke.sh
-
You now have a working, HA, secure K8s cluster running in AWS. Do things with it.
-
When you're done, remove everything:
terraform destroy
- Don't use Ansible for rolling out cloud infrastructure. There's no clean way to delete/undo the damage done.
- Terraform is drunk with configuration powers.
- Run
ExecStart
command from service files by hand first.