WritingScalewayScalewaypublished Jul 21, 2022seen 5d

How to deploy and distribute the workload on a multi-cloud Kubernetes environment

Open original ↗

Captured source

source ↗
published Jul 21, 2022seen 5dcaptured 3dhttp 200method plain

How to deploy and distribute the workload on a multi-cloud Kubernetes environment Deploy • Emmanuelle Demompion • 21/07/22 • 31 min read

This article will guide you through the best practices to deploy and distribute the workload on a Kubernetes environment on Scaleway's Kosmos .

⚠️ Warning reminder

This article will balance between concept explanations and operations or commands that need to be performed by the reader.

If this icon (🔥) is present before an image, a command, or a file, you are required to perform an action.

So remember, when 🔥 is on, so are you!

Redundancy

🔥 Labels

First, we are going to start by listing your nodes, and more specifically their associated labels. The kubectl get nodes --show-labels command will perform this action for us.

🔥 kubectl get nodes --show-labels --no-headers | awk '{print "NODE NAME: "$1","$6"\n"}' | tr "," "\n"

Output

NODE NAME : scw - kosmos - kosmos - scw - 09371579edf54552b0187a95 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / instance - type = DEV1 - M beta . kubernetes . io / os = linux failure - domain . beta . kubernetes . io / region = nl - ams failure - domain . beta . kubernetes . io / zone = nl - ams - 1 k8s . scaleway . com / kapsule = b58ad1f6 - 2a4d - 4c0b - 8573 - 459fad62682f k8s . scaleway . com / managed = true k8s . scaleway . com / node = 09371579 - edf5 - 4552 - b018 - 7a95e779b70e k8s . scaleway . com / pool - name = kosmos - scw k8s . scaleway . com / pool = 313ccb19 - 0233 - 4dc9 - b582 - b1e687903b7a k8s . scaleway . com / runtime = containerd kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - kosmos - scw - 09371579edf54552b0187a95 kubernetes . io / os = linux node . kubernetes . io / instance - type = DEV1 - M topology . csi . scaleway . com / zone = nl - ams - 1 topology . kubernetes . io / region = nl - ams topology . kubernetes . io / zone = nl - ams - 1 NODE NAME : scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / os = linux k8s . scw . cloud / disable - lifecycle = true k8s . scw . cloud / node - public - ip = 151.115 .36 .196 kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 kubernetes . io / os = linux topology . kubernetes . io / region = scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 NODE NAME : scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / os = linux k8s . scw . cloud / disable - lifecycle = true k8s . scw . cloud / node - public - ip = 65.21 .146 .191 kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 kubernetes . io / os = linux topology . kubernetes . io / region = scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 CopyContentIcon Copy code For each of our three nodes, we see many labels. The first node on the list has considerably more labels as it is managed by a Kubernetes Kosmos engine. In this case, more information about features and node management is added.

🔥 Adding labels to distinguish Cloud providers

As it might not be easy to remember which node comes from which provider, and as it can help us distribute our workload across providers, we are going to label our nodes with a label called provider with values such as scaleway or hetzner .

kubectl label nodes scw-kosmos-kosmos-scw-09371579edf54552b0187a95 provider=scaleway

kubectl label nodes scw-kosmos-worldwide-5ecdb6d02cf84d63937af45a6 provider=scaleway

kubectl label nodes scw-kosmos-worldwide-b2db708b0c474decb7447e0d6 provider=hetzner

In addition, we are also going to add label to our unmanaged Scaleway node to specify that it is, in fact, not managed by the engine. For that we use the same label used on the managed Scaleway node, but set to false: k8s.scaleway.com/managed=false .

kubectl label nodes scw-kosmos-worldwide-5ecdb6d02cf84d63937af45a6 k8s.scaleway.com/managed=false

🔥 Listing our labels

Let's list our labels to ensure that the provider label is well set on our three nodes.

🔥 kubectl get nodes --show-labels --no-headers | awk '{print "NODE NAME: "$1","$6"\n"}' | tr "," "\n"

Output

NODE NAME : scw - kosmos - kosmos - scw - 09371579edf54552b0187a95 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / instance - type = DEV1 - M beta . kubernetes . io / os = linux failure - domain . beta . kubernetes . io / region = nl - ams failure - domain . beta . kubernetes . io / zone = nl - ams - 1 k8s . scaleway . com / kapsule = b58ad1f6 - 2a4d - 4c0b - 8573 - 459fad62682f k8s . scaleway . com / managed = true k8s . scaleway . com / node = 09371579 - edf5 - 4552 - b018 - 7a95e779b70e k8s . scaleway . com / pool - name = kosmos - scw k8s . scaleway . com / pool = 313ccb19 - 0233 - 4dc9 - b582 - b1e687903b7a k8s . scaleway . com / runtime = containerd kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - kosmos - scw - 09371579edf54552b0187a95 kubernetes . io / os = linux node . kubernetes . io / instance - type = DEV1 - M provider = scaleway topology . csi . scaleway . com / zone = nl - ams - 1 topology . kubernetes . io / region = nl - ams topology . kubernetes . io / zone = nl - ams - 1 NODE NAME : scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / os = linux k8s . scaleway . com / managed = false k8s . scw . cloud / disable - lifecycle = true k8s . scw . cloud / node - public - ip = 151.115 .36 .196 kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 kubernetes . io / os = linux provider = scaleway topology . kubernetes . io / region = scw - kosmos - worldwide - 5ecdb6d02cf84d63937af45a6 NODE NAME : scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 beta . kubernetes . io / arch = amd64 beta . kubernetes . io / os = linux k8s . scw . cloud / disable - lifecycle = true k8s . scw . cloud / node - public - ip = 65.21 .146 .191 kubernetes . io / arch = amd64 kubernetes . io / hostname = scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 kubernetes . io / os = linux provider = hetzner topology . kubernetes . io / region = scw - kosmos - worldwide - b2db708b0c474decb7447e0d6 CopyContentIcon Copy code Deployment and observation: What happens in a Multi-Cloud cluster?

🔥 A first very simple deployment

To better…

Excerpt shown — open the source for the full document.