k8slightsail
Description
This tool is used for provisioning kubernetes (k8s) cluster base on lightsail service of AWS.
It's just using for lab k8s. Provision when you need, delete it when you dont need to save money.
- Number of master (depend on your choice)
- Number of worker (depend on your choice)
- Loadbalancing: 1
Some tools are preinstalled:
- Master: (systemd is preconfigured)
- kubeadm
- containerd
- curl
- kubectl
- kubelet
- nfs-common
- open-iscsi
- Worker: (systemd is preconfigured)
- kubeadm
- containerd
- curl
- kubelet
- nfs-common
- open-iscsi
- Loadbalancing:
- curl
- haproxy
Tested
- Ubuntu 20.04 LTS
Install golang compiler
Install this app
go install
Run
Init cluster
k8s_lightsail up
config.yml file is going to be created automatically like
region: ap-northeast-1
nodes:
- name: k8s-master-8674665223082153552
type: master
zone: ap-northeast-1a
username: ubuntu
public_ip: 18.183.224.164
private_ip: 172.26.11.256
- name: k8s-master-6129484611666145822
type: master
zone: ap-northeast-1c
username: ubuntu
public_ip: 175.41.232.63
private_ip: 172.26.16.44
- name: k8s-master-4037200794235010052
type: master
zone: ap-northeast-1d
username: ubuntu
public_ip: 13.230.39.207
private_ip: 172.26.43.48
- name: k8s-loadbalancing-3916589616287113938
type: loadbalancing
zone: ap-northeast-1a
username: ubuntu
public_ip: 13.115.118.175
private_ip: 172.26.15.164
- name: k8s-worker-6334824724549167321
type: worker
zone: ap-northeast-1c
username: ubuntu
public_ip: 54.249.173.204
private_ip: 172.26.20.230
- name: k8s-worker-605394647632969759
type: worker
zone: ap-northeast-1d
username: ubuntu
public_ip: 52.195.19.202
private_ip: 172.26.33.174
- name: k8s-worker-1443635317331776149
type: worker
zone: ap-northeast-1a
username: ubuntu
public_ip: 54.238.182.222
private_ip: 172.26.7.185
- name: k8s-worker-894385949183117217
type: worker
zone: ap-northeast-1c
username: ubuntu
public_ip: 18.183.47.62
private_ip: 172.26.29.169
- name: k8s-worker-2775422040480279450
type: worker
zone: ap-northeast-1d
username: ubuntu
public_ip: 3.112.110.17
private_ip: 172.26.39.114
ssh_key_pair_name: sshkey-5577006791947779411
ssh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V0mz71dipxoLuTAz6ckGfHzgGapG==
List
k8s_lightsail ls
Play with SSH
k8s_lightsail ssh <#number>
Next step
- Config your loadbalancer with IP masters as layer 4
- Init k8s cluster at master node with control lane IP = loadbalancer IP
Delete cluster
k8s_lightsail down