diy-kubernetes
diy-kubernetes copied to clipboard
DIY Kubernetes
DIY Kubernetes
WARNING: These instructions must be run as root
, and will expose all standard Kubernetes ports and a few non-standard ports to potential security attacks. Use at your own risk.
Running one Master and many Nodes on different hosts.
Create a Kubernetes clusters. Tested on Ubuntu baremetal and AWS EC2.
Requirements
- Ubuntu 18.04
- Docker
Run the Master
-
git clone https://github.com/mingfang/docker-kubernetes-master
-
cd docker-kubernetes-master
-
./build
-
./run
The Master is now running
Run the Nodes(one per host)
Note: Tested on Ubuntu 18.04. Newer versions should work but not tested.
-
git clone https://github.com/mingfang/docker-kubernetes-node
-
cd docker-kubernetes-node
-
./build
- On the Master, run
docker exec kmaster /bootstrap-tokens.sh
to generate the keys needed. - On the Node, run the command printed by #4. Should look something like this
KUBELET_TOKEN=s.oKCwIqfs7LGbIHJv666K9oFV PROXY_TOKEN=s.4TkiUcFsscWufhHUOzPjKgxn ./run <master-host>
The Node is now running. Repeat for every host that runs the Nodes.
Verify
-
alias kubectl='docker exec kmaster kubectl'
on the Master host -
kubectl get nodes
- You should see all the Nodes running
NAME LABELS STATUS
192.168.1.160 host=minux,kubernetes.io/hostname=192.168.1.160 Ready
192.168.1.162 host=vm2,kubernetes.io/hostname=192.168.1.162 Ready
192.168.1.163 host=vm3,kubernetes.io/hostname=192.168.1.163 Ready
192.168.1.164 host=vm4,kubernetes.io/hostname=192.168.1.164 Ready
192.168.1.168 host=vm1,kubernetes.io/hostname=192.168.1.168 Ready