Skip to content

Commit f443e4e

Browse files
authored
Add Valkey on k0rdent blog post (#301)
### Description Adds blog post "Using k0rdent MultiClusterService Template for Valkey on Kubernetes" ### Issues Resolved closes: #287 ### Check List - [x] Commits are signed per the DCO using `--signoff` By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License. --------- Signed-off-by: s3rj1k <[email protected]>
1 parent 6ee1892 commit f443e4e

File tree

3 files changed

+280
-0
lines changed

3 files changed

+280
-0
lines changed

content/authors/s3rj1k.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Serhii Ivanov
3+
extra:
4+
photo: '/assets/media/authors/s3rj1k.jpg'
5+
github: s3rj1k
6+
---
7+
8+
Serhii Ivanov is a software engineer passionate about Golang, Kubernetes and OSS.
9+
10+
Outside of work, he enjoys spending time with his family and learning new things.
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
+++
2+
title = "Using k0rdent MultiClusterService Template for Valkey on Kubernetes"
3+
description = "Learn how to deploy and manage Valkey across multiple Kubernetes clusters using k0rdent's template-driven approach for simplified multi-cluster application delivery."
4+
date = "2025-07-21 01:01:42"
5+
authors= [ "s3rj1k"]
6+
+++
7+
8+
Managing distributed applications across multiple Kubernetes clusters can be a complex and time-consuming process. This guide demonstrates how to streamline Valkey deployment using [k0rdent's](https://k0rdent.io/) `MultiClusterService` template, providing a practical example of modern multi-cluster application delivery.
9+
10+
In this tutorial, we'll walk through deploying Valkey across Kubernetes clusters using k0rdent's template-driven approach. By the end of this guide, you will understand how to leverage k0rdent for simplified Valkey deployment and multi-cluster application management.
11+
12+
## Prerequisites
13+
14+
It is assumed that you have basic knowledge of:
15+
- Valkey and its use cases
16+
- Kubernetes clusters and core concepts
17+
- Helm charts and package management
18+
19+
You will also need the following tools installed:
20+
- [Docker](https://docs.docker.com/desktop/) (running as a daemon)
21+
- [kind](https://kind.sigs.k8s.io/) CLI
22+
- [kubectl](https://kubernetes.io/docs/tasks/tools/) CLI
23+
- [helm](https://helm.sh/) CLI
24+
25+
## The k0* Family
26+
27+
k0rdent is part of the k0* family of tools:
28+
- **[k0s](https://k0sproject.io/)**: Zero Friction Kubernetes Distribution
29+
- **[k0smotron](https://k0smotron.io/)**: k0s specific CAPI providers
30+
- **[k0rdent](https://k0rdent.io/)**: Multi-cluster management platform
31+
32+
## What is k0rdent?
33+
34+
k0rdent is a Kubernetes-native, distributed container management platform that simplifies and automates the deployment, scaling, and lifecycle management of Kubernetes clusters across multi-cloud and hybrid environments by using a template-driven approach. You can think of it as a super control plane for multiple child clusters that are controlled by different CAPI providers across multi-cloud environments.
35+
36+
All providers (infrastructure, cluster) are packaged as Helm templates and exposed to the consumer via an entry point object called `ClusterDeployment`. The `ClusterDeployment` object is what the consumer uses to declaratively define a new child cluster, and combined with credentials-related objects, this provides the consumer with a managed Kubernetes cluster on any platform that has existing CAPI providers.
37+
38+
Check out this [CNCF blog post](https://www.cncf.io/blog/2025/02/24/introducing-k0rdent-design-deploy-and-manage-kubernetes-based-idps/) for additional information.
39+
40+
## Service Templates and Application Delivery
41+
42+
For any child cluster under k0rdent management, the consumer can control application delivery via service template objects, meaning that it is possible to install applications into the child clusters and have everything controlled from the super-control-plane (management cluster) where k0rdent itself runs.
43+
44+
The k0rdent project maintains a public repository called the "[Catalog](https://catalog.k0rdent.io/latest/)" where you can find pre-built application service templates. While templates can be created locally, and there is no hard requirement to use the catalog, we'll use the catalog for a more streamlined experience with Valkey delivery to child clusters. You can find the Valkey template in the catalog at [https://catalog.k0rdent.io/latest/apps/valkey](https://catalog.k0rdent.io/latest/apps/valkey).
45+
46+
## Demo Setup Overview
47+
48+
In this practical demonstration, we'll:
49+
50+
1. Use Kind for the management cluster
51+
2. Deploy to a child cluster using Cluster API Provider Docker (CAPD)
52+
3. Use [Hyperspike's Valkey Operator](https://github.com/hyperspike/valkey-operator) to manage Valkey instances
53+
54+
While we use Docker and Kind for simplicity, k0rdent supports any CAPI provider and can run on any Kubernetes distribution for production deployments.
55+
56+
There is no better way of getting to know something than by doing it, so I encourage you to follow along with the steps if possible.
57+
58+
## Setting Up the Management Cluster
59+
60+
Let's start by creating a new Kind cluster with a mounted Docker socket:
61+
62+
```bash
63+
cat << 'EOF' | kind create cluster --name kind --config=-
64+
kind: Cluster
65+
apiVersion: kind.x-k8s.io/v1alpha4
66+
nodes:
67+
- role: control-plane
68+
extraMounts:
69+
- hostPath: /var/run/docker.sock
70+
containerPath: /var/run/docker.sock
71+
readOnly: false
72+
EOF
73+
```
74+
75+
After Kind CLI is finished with its magic, let's install k0rdent into our new cluster:
76+
77+
```bash
78+
helm install kcm oci://ghcr.io/k0rdent/kcm/charts/kcm --version 1.0.0 -n kcm-system --create-namespace
79+
kubectl wait --for=condition=Ready=True management/kcm --timeout=9000s
80+
```
81+
82+
## Installing the Valkey Service Template
83+
84+
Now we need to install the Valkey service template like this:
85+
86+
```bash
87+
helm install valkey oci://ghcr.io/k0rdent/catalog/charts/valkey-service-template --version 0.1.0 -n kcm-system
88+
kubectl wait --for=jsonpath='{.status.valid}'=true servicetemplate/valkey-0-1-0 -n kcm-system --timeout=600s
89+
```
90+
91+
## Setting Up Credentials
92+
93+
Let's now create a group of credentials-related objects that enable the CAPD provider to work:
94+
95+
```bash
96+
kubectl apply -f - <<EOF
97+
---
98+
apiVersion: v1
99+
kind: Secret
100+
metadata:
101+
name: docker-cluster-secret
102+
namespace: kcm-system
103+
labels:
104+
k0rdent.mirantis.com/component: "kcm"
105+
type: Opaque
106+
107+
---
108+
apiVersion: k0rdent.mirantis.com/v1beta1
109+
kind: Credential
110+
metadata:
111+
name: docker-stub-credential
112+
namespace: kcm-system
113+
spec:
114+
description: Docker Credentials
115+
identityRef:
116+
apiVersion: v1
117+
kind: Secret
118+
name: docker-cluster-secret
119+
namespace: kcm-system
120+
121+
---
122+
apiVersion: v1
123+
kind: ConfigMap
124+
metadata:
125+
name: docker-cluster-credential-resource-template
126+
namespace: kcm-system
127+
labels:
128+
k0rdent.mirantis.com/component: "kcm"
129+
annotations:
130+
projectsveltos.io/template: "true"
131+
EOF
132+
```
133+
134+
## Creating the Child Cluster
135+
136+
Now we are finally ready to create our new child cluster!
137+
138+
Let's do that like this:
139+
140+
```bash
141+
kubectl apply -f - <<EOF
142+
---
143+
apiVersion: k0rdent.mirantis.com/v1beta1
144+
kind: ClusterDeployment
145+
metadata:
146+
name: docker-hosted-cp
147+
namespace: kcm-system
148+
spec:
149+
template: docker-hosted-cp-1-0-0
150+
credential: docker-stub-credential
151+
config:
152+
clusterLabels: {}
153+
clusterAnnotations: {}
154+
EOF
155+
```
156+
157+
Note how we use `docker-hosted-cp-1-0-0` as the template for the new child cluster, this will give us a CAPD-based child cluster in [Hosted Control-Plane](https://docs.k0rdent.io/head/admin/hosted-control-plane/) mode.
158+
159+
Now we wait for the child cluster to be `Ready`:
160+
161+
```bash
162+
kubectl wait --for=condition=Ready clusterdeployment/docker-hosted-cp -n kcm-system --timeout=600s
163+
kubectl wait --for=jsonpath='{.status.phase}'=Provisioned cluster/docker-hosted-cp -n kcm-system --timeout=600s
164+
kubectl wait --for=condition=Ready dockercluster/docker-hosted-cp -n kcm-system --timeout=600s
165+
kubectl wait --for=jsonpath='{.status.ready}'=true k0smotroncontrolplane/docker-hosted-cp-cp -n kcm-system --timeout=600s
166+
```
167+
168+
## Verifying the Child Cluster
169+
170+
Let's get the child cluster `kubeconfig` out and check if the cluster itself looks good:
171+
172+
```bash
173+
kubectl -n kcm-system get secret docker-hosted-cp-kubeconfig -o jsonpath='{.data.value}' | base64 -d > docker-hosted-cp.kubeconfig
174+
KUBECONFIG="docker-hosted-cp.kubeconfig" kubectl get pods -A
175+
```
176+
177+
Now we have almost everything setup for actual Valkey application delivery, we need to setup the storage provider inside our child cluster, let's use `local-path-provisioner` for simplicity:
178+
179+
```bash
180+
KUBECONFIG="docker-hosted-cp.kubeconfig" kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.31/deploy/local-path-storage.yaml
181+
KUBECONFIG="docker-hosted-cp.kubeconfig" kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
182+
```
183+
184+
**Note:** We should wait until all Pods in the child cluster are Ready, let's do that interactively, feel free to exit when pods are `Ready`:
185+
186+
```bash
187+
watch KUBECONFIG="docker-hosted-cp.kubeconfig" kubectl get pods -A
188+
```
189+
190+
## Deploying Valkey Using `MultiClusterService`
191+
192+
Whew, that was a lot of YAML, but we are finally here, and we can now see how k0rdent simplifies deploying Valkey into the child cluster!
193+
194+
Let's first add a label to our new child cluster in the management cluster, where k0rdent is running, this label will be "group=demo":
195+
196+
```bash
197+
kubectl label cluster docker-hosted-cp group=demo -n kcm-system
198+
```
199+
200+
This label is needed because we will be using a `MultiClusterService` object that can reference multiple child clusters for service/application delivery. In our case, we will use our Docker-based cluster, still, we should keep in mind that we are not restricted as to which cluster we deliver new services, it can be a single child cluster or a group of them.
201+
202+
Ok, let's do this!
203+
204+
```bash
205+
kubectl apply -f - <<EOF
206+
apiVersion: k0rdent.mirantis.com/v1alpha1
207+
kind: MultiClusterService
208+
metadata:
209+
name: valkey
210+
spec:
211+
clusterSelector:
212+
matchLabels:
213+
group: demo
214+
serviceSpec:
215+
services:
216+
- template: valkey-0-1-0
217+
name: valkey
218+
namespace: valkey-system
219+
values: |
220+
valkey:
221+
spec:
222+
tls: false # when enabled, needs CertManager (and some configs) inside child-cluster
223+
EOF
224+
```
225+
226+
In our case, `values.valkey.spec` that are exposed inside the template are Valkey Operator Helm Chart values.
227+
228+
## Verifying the Deployment
229+
230+
Let's check the object status, we should see something similar to the example output:
231+
232+
```bash
233+
kubectl get MultiClusterService -A
234+
```
235+
236+
Expected output:
237+
```
238+
NAME SERVICES CLUSTERS AGE
239+
valkey 1/1 1/1 23s
240+
```
241+
242+
Now, let's check how things look like inside the child cluster:
243+
244+
```bash
245+
KUBECONFIG="docker-hosted-cp.kubeconfig" kubectl get pods -A
246+
```
247+
248+
Expected output:
249+
```
250+
NAMESPACE NAME READY STATUS RESTARTS AGE
251+
kube-system coredns-5555f45c94-bf9mb 1/1 Running 0 23m
252+
kube-system konnectivity-agent-tfsr8 1/1 Running 0 21m
253+
kube-system kube-proxy-thx5h 1/1 Running 0 21m
254+
kube-system kube-router-6b7s8 1/1 Running 0 21m
255+
kube-system metrics-server-7778865875-s9hsz 1/1 Running 0 23m
256+
local-path-storage local-path-provisioner-74f9666bc9-5xqlf 1/1 Running 0 16m
257+
projectsveltos sveltos-agent-manager-79df48c686-8l6dk 1/1 Running 0 23m
258+
valkey-system valkey-0 1/1 Running 0 64s
259+
valkey-system valkey-operator-controller-manager-6dc5d6bf57-rbt9x 1/1 Running 0 78s
260+
```
261+
262+
It might look like pure magic at first, but what you saw was how k0rdent simplifies application delivery.
263+
264+
## Conclusion
265+
266+
Feel free to play around with the Valkey Operator by leveraging the `MultiClusterService` object together with additional Helm Chart values, and when finished, cleaning up the environment only requires deleting the Kind cluster.
267+
268+
Want to explore more? Head over to the [k0rdent docs](https://docs.k0rdent.io/latest/), and join our [Slack community](https://cloud-native.slack.com/archives/C08A63Q4NCD).
269+
270+
This is all for today, thanks for spending this time with me!
52 KB
Loading

0 commit comments

Comments
 (0)