kubernetes k3s "offline node"

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

tubs-ffm

Active Member
Sep 1, 2013
224
72
28
Hello,

is it possible to keep a Kubernetes k3s node permanently offline like a cold spare in a storage system?

I’m am new to Kubernetes and want to play around in my home lab to learn and potentially re-design my lab towards Kubernetes instead VM and LXC. HA is not intended. I am planning to build-up a virtualized k3s cluster with one or two nodes in my current 24/7 "production home lab" single server device that also is running other VMs. For maintenance, in the past I spined-up a second hypervisor and migrated the VMs temporally. This was possible with vmware, Hyper-V and Proxmox and I believe it also is possible with xcp-ng.

Now I am asking myself if similar is possible with Kubernetes: Keeping a node offline in the cluster and only spin it up in case of need to temporarily move pods. If this is not possible, I still can go the old route and migrate the complete vm in case of need.
 
  • Like
Reactions: w3max

louie1961

Active Member
May 15, 2023
440
197
43
What kind of nodes? Generally in Kubernetes, we talk about control plane nodes and worker nodes. You need at least one of each, although you can have both on the same server I believe. The control plane nodes run the main database. So I doubt if you could have one of those offline as a spare. I guess you could have a worker node off line as a spare, but to what end? That defeats the purpose of K3S. My "simple" K3S cluster consists of 3 VMs (all Ubuntu, all on Proxmox): I have one control plane node, two worker nodes. I also have a VM that I run my kubectl commands from, but I could have done this from my laptop as well. It was just easier to spin up another VM. This set up is not HA by any means. That would require at least 3 control plane nodes and 2 worker nodes.

To your question, I guess you could have a single control plane node and a single worker node on line, and have one or more worker nodes off line but ready to spin up. But Since VMs are essentially free, why bother?
 

louie1961

Active Member
May 15, 2023
440
197
43
FWIW, the biggest challenge I have overcome with K3S is using centralized shared storage (NFS CSI driver). I integrated NFS into my cluster so that my data could be backed up centrally. Otherwise if your nodes are all VMs, the storage is a bit of a sprawl and gets spread between your worker nodes on the qemu drives that Proxmox sets up (or the equivalent in other hypervisors).

I also figured out pretty quickly that K3S is more of a learning experience for me. I really doubt if I would ever use K3S for my "production" environment, which consists of a couple of Wordpress websites, a Nextcloud instance and some other assorted services like Home Assistant, Joplin, Bitwarden, and Photoprism.
 

Sean Ho

seanho.com
Nov 19, 2019
848
405
63
BC, Canada
seanho.com
What is your purpose in moving to k8s? Pods don't exactly live-migrate like VMs under PVE, but are intended to be ephemeral and disposable; you can scale them out and back in response to load. The persistent storage needs to be able to handle this; e.g., by using object storage, RWX filesystems like CephFS, or even just iSCSI volumes, where the high-availability of the backing storage is a separate issue, to be addressed by SAN or clustered storage.

I use k3s for home "prod" services, hyperconverged with rook-ceph on 5 nodes.
 

mattventura

Well-Known Member
Nov 9, 2022
721
387
63
Can't speak for k3s specifically, but generally there's nothing wrong with leaving a non-control-plane node offline for extended periods of time. It's only control plane nodes where that becomes a problem.

But if you're already virtualizing, there's nothing stopping you from just moving the node to a different host as you would with a workload VM.
 
  • Like
Reactions: tubs-ffm

tubs-ffm

Active Member
Sep 1, 2013
224
72
28
What kind of nodes? Generally in Kubernetes, we talk about control plane nodes and worker nodes. You need at least one of each, although you can have both on the same server I believe. The control plane nodes run the main database. So I doubt if you could have one of those offline as a spare. I guess you could have a worker node off line as a spare, but to what end? That defeats the purpose of K3S.
I was not specific in my question because I believed it could distract from my question. So let give some more details.

The basic principal of kubernetes is clear to me. I also understand the difference between control node and worker node. I am planning to run virtualized under Proxmox k3s. Not yet sure if worker role and control role on one node (k3s can do so), of if I split both roles in two nodes. Additionally Rancher on a separate VM. This would be by operative system that gives not mutch more value to me as a single docker instance would do but with less complexity and with less overhead. But as mentioned, I want to get into kubernetes.

My question of for "offline node" is related to an additional worker node or control node to the once running on a different physical system. The purpose would be to get these online only in case of need to shut down the proxmox server for a longer time to be able to continue running some services on these. Spin up B, train A shutdown A and later same in opposite direction.

To your question, I guess you could have a single control plane node and a single worker node on line, and have one or more worker nodes off line but ready to spin up. But Since VMs are essentially free, why bother?
My point was not the number of VM running on one Proxmox system. My point was to have nodes running temporarily on an other system that is not 24/7 connected.


FWIW, the biggest challenge I have overcome with K3S is using centralized shared storage (NFS CSI driver). I integrated NFS into my cluster so that my data could be backed up centrally.
Thank you. I am planning to use local storage provided by Proxmox. Same data I will access via NFS provided by TrueNAS.

Otherwise if your nodes are all VMs, the storage is a bit of a sprawl and gets spread between your worker nodes on the qemu drives that Proxmox sets up (or the equivalent in other hypervisors).
Thank you. I will see if performance vise I can live with this.

I also figured out pretty quickly that K3S is more of a learning experience for me. I really doubt if I would ever use K3S for my "production" environment, which consists of a couple of Wordpress websites, a Nextcloud instance and some other assorted services like Home Assistant, Joplin, Bitwarden, and Photoprism.
Same for me. I want to learn and "play" with overengineered solutions in my home lab.
I am looking with one eye to move away from Proxmox to xcp-ng. To do so I would need to give up on my LXC containers running these kind of services. Docker might be the best way to achieve this. I am going one step further if want to discover kubernetes and maybe later extend the lab depending on the outcome

What is your purpose in moving to k8s? Pods don't exactly live-migrate like VMs under PVE, but are intended to be ephemeral and disposable; you can scale them out and back in response to load. The persistent storage needs to be able to handle this; e.g., by using object storage, RWX filesystems like CephFS, or even just iSCSI volumes, where the high-availability of the backing storage is a separate issue, to be addressed by SAN or clustered storage.
Just to be able to move a part of my operative temporarily from one physical system to another to be able to maintain or update the underlaying virtualization software or the hardware. If doing this on kubernetes layer is not possible or more difficult than doing it on VM layer my question is answerd.
 

tubs-ffm

Active Member
Sep 1, 2013
224
72
28
Can't speak for k3s specifically, but generally there's nothing wrong with leaving a non-control-plane node offline for extended periods of time. It's only control plane nodes where that becomes a problem.

But if you're already virtualizing, there's nothing stopping you from just moving the node to a different host as you would with a workload VM.
Thank you.
Looks like migrating on VM layer is the better approach in this case.
 

louie1961

Active Member
May 15, 2023
440
197
43
You could do what you want with K3S, sort of. You will need an active control node and an active worker node on your alternative server. As long as the nodes can all communicate via the network it won't matter which piece of actual hardware they are on. The trick is you will always have to have at least one control node active with the etcd data store kept up to date.
 
  • Like
Reactions: tubs-ffm

louie1961

Active Member
May 15, 2023
440
197
43
I was toying with the idea of going all-in with K3s and actually having three (or more) NUC style PCs each with at least 1 control node and 1 worker node. With this configuration, a physical box could go down for whatever reason, and there would be no disruption in service. I wouldn't even need to virtualize the server OS, I could go bare metal.
 

Sean Ho

seanho.com
Nov 19, 2019
848
405
63
BC, Canada
seanho.com
With only two nodes, and usually only one of them up, the issue of quorum and split-brain arises. Perhaps consider three small always-up nodes, a la Chick-Fil-A.
 
  • Like
Reactions: seany

tubs-ffm

Active Member
Sep 1, 2013
224
72
28
With only two nodes, and usually only one of them up, the issue of quorum and split-brain arises.
Tank you.

Perhaps consider three small always-up nodes, a la Chick-Fil-A.
The background of my question is not the number of nodes for an optimum set-up. I am asking if I can run an additional worker node or a master node e.g. on a workstation that only sometimes is running.
 

seany

Member
Jul 14, 2021
40
35
18
In the cloud world we do this all the time with autoscalling groups, but only for worker nodes (in practice).

I'm actually working (very slowly) on integrating ipmi/wake-on-lan into some rules at home. I have 3 master nodes (1 vm, 1 1Lpc, one 2u server) and about 5 other machines that I use some times. Trying to get the "extra" stuff to turn off when I don't need it.
 
  • Like
Reactions: tubs-ffm

marcoi

Well-Known Member
Apr 6, 2013
1,651
377
83
Gotha Florida
My homelab is a bit of running a home prod and work dev workloads, so it's a bit of hardware. but i found for me this works out well to cover both workloads.

Compute:
  • Two servers running xcp-ng (similar hardware)
    • I run VMs for home prod stuff like opnsense, omada, game server, website. on the two servers which give me a way to bring one down one server at a time for maintenance.
    • VMs are using the NFS off the ssd Nas to allow starting/moving between two boxes.
    • VMs are backed up to storage nas.
Storage:
  • Two Qnap 16 bay Nas units with intel w-1290 cpu and 128GB ram
    • Unit 1 - runs storage and backup HDDs for home/work
      • Provides SMB, ISCSI, NFS services
      • Runs home prod dockers
        • immich, jellyfin, freshrss, etc.
    • Unit 2 - runs storage on SSDs for VM workloads
      • provides SMB, NFS services
      • Storage for VMs on XCP Servers
      • Runs Work VM using virtual station app.
On my two XCP servers i have ubuntu server VMs with nested VM enabled. I run two VMs that each run k0s certified kube cluster. This is part of my work dev lab. One VM runs ubuntu desktop so i can work with gui apps like headlamp etc. That VM runs control plan and worker node. The second VM only runs ubuntu server and k0s worker that connects to the other VM worker plane. Storage is setup using NFS back to the NAS.

Since the k0s run in a VM, XCP provided backup and snap shots of the VMS. I can also move them around the two boxes as resources dictate.

This gives me a lot of flexibility on how I run my workload.

I find VMs running using nas storage allows XCP to move them quickly between boxes for maintenance. Using Dockers on Qnap Nas runs well and mounts are all on the NAS which as snaped and backed to other storage. If i need I can update the docker and restart the app quickly. Having my work VM off running on the NAS allows me to keep it running while i do maintenance during business hours etc. Running k0s in a VM allows me to snap before i test something and power off the VM when not in use.

hope some of this helps you figure out what you want to do.
 
  • Like
Reactions: tubs-ffm