How to Build an Awesome Kubernetes Cluster using Proxmox Virtual Environment

Originally published at: How to Build an Awesome Kubernetes Cluster using Proxmox Virtual Environment – Learn Linux TV

Proxmox Virtual Environment is an awesome virtualization solution. Kubernetes is an awesome containerization solution. So why not combine those great technologies? In this video, you’ll see the entire process of setting up your very own Kubernetes cluster from scratch, with Proxmox shown as the platform. But even if you don’t plan on using Proxmox, this method will work just fine on other solutions as well, including physical servers. By the end of this video, you’ll have your own cluster ready to go!

2 Likes

That’s a full tutorial, nice.

1 Like

I’m going to make use of your blog post to create a k8s template for anything not specifically for the controller and be able to spin up multiple cluster nodes from the k8s template. It will be a whole lot easier down the road. Templates will save me a lot of copying and pasting and/or typing for me.

Thank you for an awesome tutorial.

1 Like

In line 336 of the article, I came across the two lines of code:

<pre class="wp-block-code"><code>sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://
packages.cloud.google.com/apt/doc/apt-key.gpg</code></pre>

In Firefox, that translates to the following in the inspector:

<pre class="wp-block-code">
  <code>
    sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://
packages.cloud.google.com/apt/doc/apt-key.gpg
  </code>
</pre>

When I copied the command from the article without looking at the HTML source code, this resulted in the following:

gpadmin-local@uk8s-template:~$ sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://
packages.cloud.google.com/apt/doc/apt-key.gpg
[sudo] password for gpadmin-local: 
curl: (3) URL using bad/illegal format or missing URL
-bash: packages.cloud.google.com/apt/doc/apt-key.gpg: No such file or directory

If the command inside the code can all be in one line, that might help solve the problem.

Also:

gpadmin-local@uk8s-template:~$ sudo apt install kubeadm kubectl kubelet
[sudo] password for gpadmin-local: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

No apt package "kubeadm", but there is a snap with that name.
Try "snap install kubeadm"


No apt package "kubectl", but there is a snap with that name.
Try "snap install kubectl"


No apt package "kubelet", but there is a snap with that name.
Try "snap install kubelet"

E: Unable to locate package kubeadm
E: Unable to locate package kubectl
E: Unable to locate package kubelet

At least snaps have all the packages needed, so that gpg key is no longer needed?

Update: The echo "deb ..." command is only in the video and not in the blog post.

Update 2: Here is the command for adding a repository:

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

Hopefully I can save anyone from having to type from the video.

Update 3: This is what I copied from the blog and changed it to Home Assistant:

apiVersion: v1
kind: Pod
metadata:
Chapter 18 25

name: homeassistant
  labels:
    app: homeassistant
spec:
  containers:
    - name: homeassistant
      image: linuxserver/homeassistant
      ports:
        - containerPort: 8123
          name: "home-assistant"

Applying the configuration produces the result:

error: error parsing pods.yml: error converting YAML to JSON: yaml: line 6: could not find expected ':'

I changed it to the following according to the video and it works:

apiVersion: v1
kind: Pod
metadata:
  name: homeassistant
  labels:
    app: homeassistant
spec:
  containers:
    - name: homeassistant
      image: linuxserver/homeassistant
      ports:
        - containerPort: 8123
          name: "home-assistant"

And everything is ready to go. I went ahead and created a service file:

apiVersion: v1
kind: Service
metadata:
  name: homeassistant
spec:
  type: NodePort
  ports:
    - name: hass
      port: 8123
      nodePort: 30812
      targetPort: home-assistant
  selector:
    app: homeassistant

Once I applied the service to the cluster, I now have Home Assistant running! :smiley:

I have created my first Kubernetes cluster and my first container! :smiley: