I'd like to deploy a single app to multiple servers in one time.
I'm using Kubernetes and K3S to easily deploy containers.
Basically, I have a master server that I run and multiple servers that are localed in my customers facilities.
Master server was initialized with the following command:
k3sup install \
--ip $MASTER_IP \
--user ubuntu \
--cluster --k3s-channel latest \
--k3s-extra-args "--node-label ols.role=master"
Customer's servers were launched with:
k3sup join \
--ip $WORKER01_IP \
--user ubuntu \
--server-ip $MASTER_IP \
--server-user ubuntu \
--k3s-channel latest \
--k3s-extra-args "--node-label ols.role=worker"
When I want to deploy a new web service on each customer's server, I've tried the following code:
helm install node-red k8s-at-home/node-red --set nodeSelector."ols\.role"=worker
Problem: Only one single pod is deployed.
What I'd like is to deploy a single pod on each server and make it independent. Is there a way to do that ?
Here there are two different things that we need to consider.
If the requirement is just to run more number of
replicasof theapplicationa change to thedeploymenttemplate in thehelmchart or throughvaluesyou can pass number of minimumreplicasneed to be working in the cluster.Reference documentation for
deploymentsComing to next thing, if the requirements is just to run application across all the nodes existing in the cluster,
Daemonsetsis the workload which gives the capability to run across all the existing nodes.Reference documentation for
daemonsetsAgain if you are using
helmto deploy, appropriate templates for eitherdaemonsetsordeploymentsneed to be added or modified based on the existing contents of thehelmchart.There are also different workloads
k8ssupports so based on requirements they can be picked appropriately.