Install prerequisites:
sudo apt install python3-pip
Install AWS CLI:
sudo pip install awscli
In IAM add a user kops with programmatic access. Note down your AWS keys.aws configure
Download and install binaries:
wget https://github.com/kubernetes/kops/releases/download/v1.21.0/kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops
sudo chmod +x /usr/local/bin/kops
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo mv kubectl /usr/local/bin/kubectl
sudo chmod +x /usr/local/bin/kubectl
Generate an SSH key which will be used to connect to the kops cluster:
ssh-keygen -f .ssh/id_rsa
Create a S3 bucket in your chosen region for kops state. I named it s3-kops-12345. Use this page to determine which region is faster: cloudping.info - measure latency from your browser to each AWS regionkops create cluster --name=kops.qwerty.md --state=s3://s3-kops-12345 --zones=eu-west-2a --node-count=2 --node-size=t3.micro --master-size=t3.micro --dns-zone=kops.qwerty.md
kops update cluster --name kops.qwerty.md --yes --admin --state=s3://s3-kops-12345
Validate cluster - it will test if cluster DNS works well and if it is accesible:
kops validate cluster --wait 10m
Test cluster functionality:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080
Get the port for new created service:
kubectl get svc
My output was:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube NodePort 100.67.254.62 <none> 8080:32259/TCP 9s
kubernetes ClusterIP 100.64.0.1 <none> 443/TCP 7m46s
Edit Security Group for workers and add inbound port 32259 for your IP and connect to it:kops delete cluster --name kops.qwerty.md --yes --state=s3://s3-kops-12345