Guide | Environment | Kubernetes Version |
---|---|---|
Kubernetes on AWS | ☁ AWS | v1.21 |
Kubernetes on Vagrant | 💻 Local | v1.21 |
To follow this tutorial, you need:
Setup your AWS credentials by exporting the following environment variables:
export AWS_ACCESS_KEY_ID=<YOUR_AWS_ACCESS_KEY_ID>
export AWS_SECRET_ACCESS_KEY=<YOUR_AWS_SECRET_ACCESS_KEY>
export AWS_DEFAULT_REGION=<YOUR_AWS_REGION>
In alternative, authenticate with AWS by running aws configure
in your terminal. When prompted, enter your AWS Access Key ID, Secret Access Key, region and output format.
$ aws configure
AWS Access Key ID [None]: <YOUR_AWS_ACCESS_KEY_ID>
AWS Secret Access Key [None]: <YOUR_AWS_SECRET_ACCESS_KEY>
Default region name [None]: <YOUR_AWS_REGION>
Default output format [None]: json
├── Makefile
.
.
.
├── provision
│ ├── terraform
│ └── vagrant
.
.
├── terraform-key.pem
.
.
- Follow installation guide on https://www.terraform.io/downloads.html to install Terraform
- Initialize the bootstrap provisioner:
make init
- If the initialization succeeds, apply the bootstrap provisioner:
make apply
📝 This phase may take some minutes.
- Get kubeconfig for access to your cluster:
make output
🎉 🎉 - Enjoy your Kubernetes Cluster on AWS
$kubectl --kubeconfig ~/.kube/kubernetes get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-1-165 Ready <none> 26s v1.21.0
ip-10-0-1-210 Ready control-plane,master 2m38s v1.21.0
- If you want to delete your cluster
make destroy
and after that:⚠️ - Check if all resources are deleted on aws console if you dont want be charged by AWS.
This tutorial assumes some basic familiarity with Kubernetes vanilla without Docker
To follow Vagrant tutorial, you need:
- VirtualBox - Follow installation guide on https://www.virtualbox.org/wiki/Downloads to install VirtualBox
- Vagrant - Follow installation guide on https://www.vagrantup.com/docs/installation/index.html to install Vagrant
make vagrant-start
vagrant ssh master
kubectl get all --all-namespaces
or vagrant ssh master
and copy /home/vagrant/config
to local machine
make vagrant-destroy
I was inspired by from @sighupio,@justmeandopensource