cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
827
Views
3
Helpful
3
Replies

Tales From The Crypt: Proxmox, Ubuntu Server 22.04 and Kubernetes

npetrele
Cisco Employee
Cisco Employee

This past week I've been setting up a local Kubernetes test bed for Full Stack Observability testing. I set up two Proxmox servers on mini-PCs and installed Ubuntu 22.04 server virtual machines on each of them. Why Ubuntu 22.04? Because there's a very good guide online explaining how to get Kubernetes set up using that particular version of Linux. Actually, there's more than one guide on this topic, for example this one. For the purpose of my work, though, I'll stick to the first guide I mentioned. That guide is for one control plane and two workers. I only have one worker in my setup. 

Here's a tip for before you even think of setting up Kubernetes. When you install Ubuntu 22.04, make sure you have assigned permanent IP addresses on your control plane and worker servers. Do not use DHCP.

Your /etc/netplan/00-installer-config.yaml file should look something like this:

 

network:
  ethernets:
    ens18:
      addresses:
      - 192.168.10.40/24
      nameservers:
        addresses:
        - 192.168.10.1
        search: []
      routes:
      - to: default
        via: 192.168.10.1
  version: 2

 

It's a great guide. I don't want to copy and paste all of the instructions from that site, but I will note a few things I think are missing  or incorrect from the guide. For example, there are a couple of spots where the writer does not use sudo where you will need to use sudo. You'll find out for yourself when the operations fail and tell you you need to run a command as root, but for one example, you'll need to run sudo mkdir -p /opt/bin where it only specifies mkdir -p /opt/bin

Another hiccup occurs when you try this instruction:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

That won't work, but the following will work in its place:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

And when you give the command to have your worker node join the cluster, the writer says your token and hash may be different than in his sample. I wouldn't say may be different, I'd double dad gum guarantee they'll be different. Instead of trying his join command, here's a way to get a join command with the correct token and hash for your worker node. Go to a terminal on your Control Plane (cplane1 in his examples) and execute this command:

sudo kubeadm token create --print-join-command

In my case, that command prints the following:

kubeadm join 192.168.10.40:6443 --token d79u9c.22evtkkn0arwpltx --discovery-token-ca-cert-hash sha256:591027ac99b4e04319e67e79e5251d5d106b38c036f4b5f744ecdf5c3c9c0549

Copy and paste your version of that command in a terminal window for your worker node and run it with sudo.  

Unless I missed something other than the above changes, follow that guide with my alterations and you should now have a Kubernetes cluster up and running. 

 

3 Replies 3

Ruben Cocheno
Spotlight
Spotlight

@npetrele 

Kubernetes still a complicated topic to me

Tag me to follow up.
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/

Yes, it is complicated. I followed up with a more comprehensive tutorial on getting it set up here: https://community.cisco.com/t5/devnet-general-discussions/this-week-in-tech-ubuntu-22-04-amp-kubernetes-how-to-the-long/td-p/4931011

Hopefully that will help you!

Alexander Stevenson
Cisco Employee
Cisco Employee

@Ruben Cocheno,

DevNet has free Learning Labs all about Kubernetes (K8s): https://developer.cisco.com/learning/search/?contentType=track,module,lab&keyword=Kubernetes&page=1&sortBy=luceneScore

Cisco U. mostly has paid content regarding K8s right now but there are some free tutorials towards the bottom of this page: https://u.cisco.com/search?query=kuberenetes