Manitoba
Manitoba

Reputation: 8702

Use Kubernetes to deploy a single app to multiple servers

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 ?

Upvotes: 0

Views: 3247

Answers (1)

BinaryMonster
BinaryMonster

Reputation: 1208

Here there are two different things that we need to consider.

If the requirement is just to run more number of replicas of the application a change to the deployment template in the helm chart or through values you can pass number of minimum replicas need to be working in the cluster.

Reference documentation for deployments

Coming to next thing, if the requirements is just to run application across all the nodes existing in the cluster, Daemonsets is the workload which gives the capability to run across all the existing nodes.

Reference documentation for daemonsets

Again if you are using helm to deploy, appropriate templates for either daemonsets or deployments need to be added or modified based on the existing contents of the helm chart.

There are also different workloads k8s supports so based on requirements they can be picked appropriately.

Upvotes: 2

Related Questions