Basic Kubernetes Cluster with 2 VMs
I’m researching for my next Unix Tutorial Project, so today I’m spinning up two new Ubuntu 19.10 VMs and configuring them as Kubernetes Master and Kubernetes Node, accessible from my macOS desktop.
This is just a bunch of notes on the topic, the project will have the full procedure (and a YouTube video, if everything works out as I expect).
NOTE: I’m using install instructions supplied by Docker and Google for their packages install. Apparently, there’s a few more ways and packaging systems to get similar results specifically on Ubuntu.
Step 1: Spin Up the 2 VMs
I chose Ubuntu, but any Linux capable of running Docker should be fine.
The plan is to have one VM as Kubernetes Master (k8master) and another VM as Kubernetes Node (k8node1) – that’s where our containers will actually run.
I’m using Parallels on macOS, it has this express install which means you just point it at an ISO and it does unattended Ubuntu install. Really cool!
Step 2: Configure Host-Only Networking
Now, we need to shut down both VMs and then add host-only network adapter to each – this will be used for cluster communication and for remotely managing k8s.
IMPORTANT: this is an additional interface. The primary one is separate and used for Internet access (cause we need it to install software).
Step 3: Install Docker and Kubernetes on both VMs
Pretty standard procedure, following official install guides. This needs to be done on both Ubuntu 19.10 VMs.
The only thing is that Ubuntu 19.10 (code name Eoan in repo URLs) is not supported properly, so I ended up using previous distro codename (disco) for Docker URL:
Install Docker
Install k8s (Kubernetes)
Step 4: Setup Kubernetes Cluster
This means starting a master node:
and then using the command from the output in previous step, join the Kubernetes node 1 to the cluster:
This is how we’d verify status:
Confirm status of nodes:
Step 5: Connect to Kubernetes Master from my desktop
This step will need some consideration because I already have local Kubernetes setup on my desktop (via docker-desktop), which I’d like to keep. So I’ll need to add another configuration, I suspect.
That’s all for now!
See Also
I’m researching for my next Unix Tutorial Project, so today I’m spinning up two new Ubuntu 19.10 VMs and configuring them as Kubernetes Master and Kubernetes Node, accessible from my macOS desktop.
This is just a bunch of notes on the topic, the project will have the full procedure (and a YouTube video, if everything works out as I expect).
NOTE: I’m using install instructions supplied by Docker and Google for their packages install. Apparently, there’s a few more ways and packaging systems to get similar results specifically on Ubuntu.
Step 1: Spin Up the 2 VMs
I chose Ubuntu, but any Linux capable of running Docker should be fine.
The plan is to have one VM as Kubernetes Master (k8master) and another VM as Kubernetes Node (k8node1) – that’s where our containers will actually run.
I’m using Parallels on macOS, it has this express install which means you just point it at an ISO and it does unattended Ubuntu install. Really cool!
Step 2: Configure Host-Only Networking
Now, we need to shut down both VMs and then add host-only network adapter to each – this will be used for cluster communication and for remotely managing k8s.
IMPORTANT: this is an additional interface. The primary one is separate and used for Internet access (cause we need it to install software).
Step 3: Install Docker and Kubernetes on both VMs
Pretty standard procedure, following official install guides. This needs to be done on both Ubuntu 19.10 VMs.
The only thing is that Ubuntu 19.10 (code name Eoan in repo URLs) is not supported properly, so I ended up using previous distro codename (disco) for Docker URL:
Install Docker
Install k8s (Kubernetes)
Step 4: Setup Kubernetes Cluster
This means starting a master node:
and then using the command from the output in previous step, join the Kubernetes node 1 to the cluster:
This is how we’d verify status:
Confirm status of nodes:
Step 5: Connect to Kubernetes Master from my desktop
This step will need some consideration because I already have local Kubernetes setup on my desktop (via docker-desktop), which I’d like to keep. So I’ll need to add another configuration, I suspect.
That’s all for now!