<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gianluca</title>
    <description>The latest articles on DEV Community by Gianluca (@gianlucam76).</description>
    <link>https://dev.to/gianlucam76</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F979179%2Fdecdb6bd-4f4b-4d7e-ae9d-560a0e29ede9.jpeg</url>
      <title>DEV Community: Gianluca</title>
      <link>https://dev.to/gianlucam76</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gianlucam76"/>
    <language>en</language>
    <item>
      <title>Stop Forking Your YAML</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Mon, 23 Feb 2026 12:52:20 +0000</pubDate>
      <link>https://dev.to/gianlucam76/stop-forking-your-yaml-19cf</link>
      <guid>https://dev.to/gianlucam76/stop-forking-your-yaml-19cf</guid>
      <description>&lt;p&gt;&lt;em&gt;TL;DR&lt;/em&gt;: Managing multi-cluster YAML usually leads to Copy-Paste drift or Helm-chart bloat. This post demonstrates how to use a surgical post-processor to decouple global application intent from regional infrastructure needs using Late-Binding.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: The "Copy-Paste" Trap
&lt;/h2&gt;

&lt;p&gt;In a traditional setup, when you have a core application that needs a slight tweak for a specific region (like our EU vs. US example), you generally have three bad options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;The Forking Nightmare&lt;/em&gt;: You create a &lt;code&gt;deployment-us.yaml&lt;/code&gt; and a &lt;code&gt;deployment-eu.yaml&lt;/code&gt;. This works for a week. Then, you update the container image in the US version but forget the EU version. Your clusters are now &lt;strong&gt;drifting&lt;/strong&gt;, and your global consistency is broken.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;The Helm "Value" Bloat&lt;/em&gt;: You try to make the Helm chart handle everything. You add &lt;strong&gt;if/else&lt;/strong&gt; blocks for every possible regional variable. Your &lt;code&gt;values.yaml&lt;/code&gt; becomes a 2,000-line monster that is impossible to read, and you are still limited by what the original chart author decided to expose.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Manual Intervention&lt;/em&gt;: You deploy the base app and then have a human (or a fragile script) go in and manually patch the environment variables. This is the opposite of GitOps and is prone to human error.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The core of the problem is that &lt;strong&gt;Location&lt;/strong&gt; is an infrastructure property, but &lt;strong&gt;Configuration&lt;/strong&gt; is an application property. Standard tools force you to mix them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc76z20m38rucuk24zcl8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc76z20m38rucuk24zcl8.png" alt="Standardization vs. Localization: Avoid the " width="800" height="743"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Vision: A "Location-Aware" Delivery System
&lt;/h2&gt;

&lt;p&gt;To solve the multi-cluster dilemma, we need to move away from traditional "template-and-deploy" models. A truly scalable solution should function like a &lt;strong&gt;Surgical Post-Processor&lt;/strong&gt; - an intelligent layer that sits between your global source of truth and your local clusters.&lt;/p&gt;

&lt;p&gt;A working solution must decouple &lt;strong&gt;What&lt;/strong&gt; you are deploying from &lt;strong&gt;Where&lt;/strong&gt; it is going. Here is how that ideal workflow functions in practice:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Centralized Intent&lt;/strong&gt;&lt;br&gt;
You define a single, global &lt;strong&gt;Intent&lt;/strong&gt;. Instead of managing individual clusters, you manage &lt;strong&gt;logical groups&lt;/strong&gt;. You simply state: "I want the Customer Portal application deployed to every cluster labeled app: portal." This keeps your configuration clean and centralized, regardless of whether you have ten clusters or ten thousand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic Discovery&lt;/strong&gt;&lt;br&gt;
The system must be reactive. When a new cluster is provisioned - for example, in &lt;strong&gt;France &lt;/strong&gt;- it should automatically be "discovered" by its metadata (e.g., location: europe). The deployment system sees this new destination and understands its unique identity without a human ever having to update a manual list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Surgical Patching (The "DNA Splice")&lt;/strong&gt;&lt;br&gt;
This is the core of the solution. Instead of re-rendering an entire Helm chart with different values - which is often limited by what the chart developer allows - the system takes the final, fully-rendered YAML and "splices" in regional requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Overcoming the "Missing Knob" Bottleneck&lt;/strong&gt;&lt;br&gt;
In traditional models, a Local SRE is often blocked if the Global App Architect didn't "expose a knob" (a parameter or variable) in the original template. With a Surgical Post-Processor, that dependency is broken:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global Team&lt;/strong&gt;: Maintains a clean, generic &lt;strong&gt;Immutable&lt;/strong&gt; Core. They focus on the "Gold Standard" manifest that works everywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local SRE&lt;/strong&gt;: If a regional requirement (like a specific security sidecar or a unique mounting point) isn't supported by the base template, the SRE creates an independent &lt;strong&gt;External Patch&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Result&lt;/strong&gt;: The system injects these "missing knobs" directly into the final manifest at runtime. Local teams no longer have to wait for Global PR approvals to meet urgent regional compliance or infrastructure needs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Late Binding&lt;/strong&gt;&lt;br&gt;
Localization details should not be hardcoded into the application code or the main deployment manifest. Instead, they should exist as independent &lt;code&gt;Policy Packets&lt;/code&gt; that are only bound to the application at the final moment of delivery. This ensures that the application remains generic and portable, while the regional nuances are managed as separate, modular entities.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frd0t4bgepy0tnnrnldfa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frd0t4bgepy0tnnrnldfa.png" alt="Solution" width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One Management Cluster. Infinite Possibilities. Total Control
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;&lt;strong&gt;Sveltos&lt;/strong&gt;&lt;/a&gt; is a set of Kubernetes controllers that run in a &lt;strong&gt;central management cluster&lt;/strong&gt;. From this single point of control, Sveltos can manage add-ons and applications across a vast fleet of managed Kubernetes clusters. It is a strictly &lt;strong&gt;declarative&lt;/strong&gt; tool: you define the "Desired State" on the management cluster, and Sveltos ensures that state is reflected in every managed cluster, automatically correcting any drift.&lt;/p&gt;

&lt;p&gt;In the management cluster, each individual managed Kubernetes cluster is represented by a dedicated resource. Because these are standard Kubernetes resources, you can attach &lt;strong&gt;Labels&lt;/strong&gt; to them to categorize your fleet by region, purpose, or compliance tier.&lt;br&gt;
Sveltos configuration utilizes a concept called a &lt;strong&gt;cluster selector&lt;/strong&gt;. This selector acts like a dynamic filter based on those Kubernetes labels. By defining specific labels or combinations of labels, you can create a subset of clusters that share those characteristics - such as all clusters located in "Europe."&lt;/p&gt;
&lt;h3&gt;
  
  
  The Working Solution: Sveltos in Action
&lt;/h3&gt;

&lt;p&gt;When you deploy our Customer Portal, Sveltos doesn't just push a static file. It follows a dynamic pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Identify: The Cluster Selector&lt;/strong&gt;&lt;br&gt;
Sveltos continuously monitors your fleet. It identifies a cluster because it matches a selector like env: prod and app: portal.&lt;br&gt;
Contextualize: Discovery via Labels Sveltos looks at the cluster's metadata. If the cluster has the label location: europe, Sveltos uses that variable to dynamically "point" to your portal-patch-europe ConfigMap.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The "Surgical Splice": patchesFrom in Action&lt;/strong&gt;&lt;br&gt;
This is where the magic happens. Sveltos takes your generic "Vanilla" Deployment (the one that has no idea Europe exists) and your Generic ConfigMap, and performs two precise operations based on your YAML: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The ConfigMap Splice&lt;/strong&gt;: It injects the EU-specific HTML (&lt;code&gt;&amp;lt;h1&amp;gt;Welcome to the EU Portal&amp;lt;/h1&amp;gt;&lt;/code&gt;) into the regional-config object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Deployment Splice&lt;/strong&gt;:  It adds a volume and a volumeMount to the customer-portal Deployment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Late Binding: The Final Result&lt;/strong&gt;&lt;br&gt;
The application remains generic in your Git repository. The "EU-ness" is only bound to the application at the very last millisecond before the YAML is applied to the cluster.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1655wm2bd8d89r0w94x.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1655wm2bd8d89r0w94x.gif" alt="Sveltos Patches" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The Concrete Demo
&lt;/h2&gt;

&lt;p&gt;Let's build it. We will use a simple &lt;strong&gt;NGINX Deployment&lt;/strong&gt; as our "Customer Portal" and inject regional identity.&lt;br&gt;
A Kind cluster is used as management cluster. Then two extra Civo clusters all with label &lt;code&gt;app=portal&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+------------------------+-------------+-------------------------------------+
|    Cluster Name        |   Version   |             Comments                |
+------------------------+-------------+-------------------------------------+
|    site-us/portal      | v1.33.6-k3s1| Civo 3 Node - Medium Standard       |
|    site-eu/portal      | v1.32.5+k3s1| Civo 3 Node - Medium Standard       |
+------------------------+-------------+-------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Sveltos on Managament Cluster&lt;/strong&gt;
For this tutorial, we will install Sveltos in the management cluster. Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/latest/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; https://raw.githubusercontent.com/projectsveltos/sveltos/v1.5.1/manifest/manifest.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And &lt;a href="https://projectsveltos.github.io/sveltos/main/register/register-cluster/" rel="noopener noreferrer"&gt;register&lt;/a&gt; the cluster with Sveltos&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get sveltoscluster &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;--show-labels&lt;/span&gt;
NAMESPACE   NAME     READY   VERSION        AGE     LABELS
site-eu     portal   &lt;span class="nb"&gt;true    &lt;/span&gt;v1.32.5+k3s1   3m43s   &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;portal,location&lt;span class="o"&gt;=&lt;/span&gt;europe
site-us     portal   &lt;span class="nb"&gt;true    &lt;/span&gt;v1.33.6+k3s1   4m20s   &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;portal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Define the Global Application (The "What")&lt;/strong&gt;
This is our generic manifest stored in a ConfigMap on the management cluster. It has no regional logic and stays 100% standardized.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;portal-base-manifests&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deployment.yaml&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;apiVersion: v1&lt;/span&gt;
    &lt;span class="s"&gt;kind: Service&lt;/span&gt;
    &lt;span class="s"&gt;metadata:&lt;/span&gt;
      &lt;span class="s"&gt;name: portal-service&lt;/span&gt;
    &lt;span class="s"&gt;spec:&lt;/span&gt;
      &lt;span class="s"&gt;selector:&lt;/span&gt;
        &lt;span class="s"&gt;app: portal&lt;/span&gt;
      &lt;span class="s"&gt;ports:&lt;/span&gt;
      &lt;span class="s"&gt;- protocol: TCP&lt;/span&gt;
        &lt;span class="s"&gt;port: 80&lt;/span&gt;
        &lt;span class="s"&gt;targetPort: 80&lt;/span&gt;
    &lt;span class="s"&gt;---&lt;/span&gt;
    &lt;span class="s"&gt;apiVersion: v1&lt;/span&gt;
    &lt;span class="s"&gt;kind: ConfigMap&lt;/span&gt;
    &lt;span class="s"&gt;metadata:&lt;/span&gt;
      &lt;span class="s"&gt;name: regional-config&lt;/span&gt;
    &lt;span class="s"&gt;data: {} # Empty! No index.html yet.&lt;/span&gt;
    &lt;span class="s"&gt;---&lt;/span&gt;
    &lt;span class="s"&gt;apiVersion: apps/v1&lt;/span&gt;
    &lt;span class="s"&gt;kind: Deployment&lt;/span&gt;
    &lt;span class="s"&gt;metadata:&lt;/span&gt;
      &lt;span class="s"&gt;name: customer-portal&lt;/span&gt;
    &lt;span class="s"&gt;spec:&lt;/span&gt;
      &lt;span class="s"&gt;replicas: 1&lt;/span&gt;
      &lt;span class="s"&gt;selector:&lt;/span&gt;
        &lt;span class="s"&gt;matchLabels:&lt;/span&gt;
          &lt;span class="s"&gt;app: portal&lt;/span&gt;
      &lt;span class="s"&gt;template:&lt;/span&gt;
        &lt;span class="s"&gt;metadata:&lt;/span&gt;
          &lt;span class="s"&gt;labels:&lt;/span&gt;
            &lt;span class="s"&gt;app: portal&lt;/span&gt;
        &lt;span class="s"&gt;spec:&lt;/span&gt;
          &lt;span class="s"&gt;volumes: []&lt;/span&gt;
          &lt;span class="s"&gt;containers:&lt;/span&gt;
          &lt;span class="s"&gt;- name: nginx&lt;/span&gt;
            &lt;span class="s"&gt;image: nginx:latest&lt;/span&gt;
            &lt;span class="s"&gt;volumeMounts: [] # Initialize here too&lt;/span&gt;
            &lt;span class="s"&gt;env:&lt;/span&gt;
            &lt;span class="s"&gt;- name: APP_MODE&lt;/span&gt;
              &lt;span class="s"&gt;value: "production"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create the Regional Policy Packet (The "Late Binding")&lt;/strong&gt;
On the management cluster, we define the "EU-specific" instructions.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;portal-patch-europe&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;configmap-patch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|2&lt;/span&gt;
      &lt;span class="s"&gt;target:&lt;/span&gt;
        &lt;span class="s"&gt;kind: ConfigMap&lt;/span&gt;
        &lt;span class="s"&gt;name: regional-config&lt;/span&gt;
      &lt;span class="s"&gt;patch: |&lt;/span&gt;
        &lt;span class="s"&gt;- op: add&lt;/span&gt;
          &lt;span class="s"&gt;path: /data/index.html&lt;/span&gt;
          &lt;span class="s"&gt;value: |&lt;/span&gt;
            &lt;span class="s"&gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Welcome to the EU Portal&amp;lt;/h1&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
  &lt;span class="na"&gt;deployment-patch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|2&lt;/span&gt;
      &lt;span class="s"&gt;target:&lt;/span&gt;
        &lt;span class="s"&gt;kind: Deployment&lt;/span&gt;
        &lt;span class="s"&gt;name: customer-portal&lt;/span&gt;
      &lt;span class="s"&gt;patch: |&lt;/span&gt;
        &lt;span class="s"&gt;- op: add&lt;/span&gt;
          &lt;span class="s"&gt;path: /spec/template/spec/volumes/-&lt;/span&gt;
          &lt;span class="s"&gt;value:&lt;/span&gt;
            &lt;span class="s"&gt;name: html-volume&lt;/span&gt;
            &lt;span class="s"&gt;configMap:&lt;/span&gt;
              &lt;span class="s"&gt;name: regional-config&lt;/span&gt;
        &lt;span class="s"&gt;- op: add&lt;/span&gt;
          &lt;span class="s"&gt;path: /spec/template/spec/containers/0/volumeMounts/-&lt;/span&gt;
          &lt;span class="s"&gt;value:&lt;/span&gt;
            &lt;span class="s"&gt;name: html-volume&lt;/span&gt;
            &lt;span class="s"&gt;mountPath: /usr/share/nginx/html/index.html&lt;/span&gt;
            &lt;span class="s"&gt;subPath: index.html&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Orchestrator (The ClusterProfile)&lt;/strong&gt;
This tells Sveltos how to tie the "What" to the "Where" using the &lt;strong&gt;patchesFrom&lt;/strong&gt; logic.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy-portal-fleet&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;portal&lt;/span&gt;

  &lt;span class="na"&gt;policyRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;portal-base-manifests&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;

  &lt;span class="c1"&gt;# The Surgical Splice logic&lt;/span&gt;
  &lt;span class="na"&gt;patchesFrom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
    &lt;span class="c1"&gt;# The Power of Templating:&lt;/span&gt;
    &lt;span class="c1"&gt;# This dynamically resolves to 'portal-patch-europe' for EU clusters&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;portal-patch-{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;index&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.Cluster.metadata.labels&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;location&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;optional&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the ClusterProfile active, Sveltos acts as the intelligent orchestrator. It identifies the clusters, evaluates their metadata, and applies the "Surgical Splice" only where the conditions are met.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Verification of Deployment&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Running &lt;code&gt;sveltosctl&lt;/code&gt; confirms that the global intent has been successfully realized across our fleet. Both the US and EU clusters received the base application, but their internal configurations differ based on their labels.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sveltosctl show addons
┌────────────────┬─────────────────┬───────────┬─────────────────┬─────────┬───────────────────────────────┬─────────────────┬────────────────────────────────────┐
│    CLUSTER     │  RESOURCE TYPE  │ NAMESPACE │      NAME       │ VERSION │             TIME              │ DEPLOYMENT TYPE │              PROFILES              │
├────────────────┼─────────────────┼───────────┼─────────────────┼─────────┼───────────────────────────────┼─────────────────┼────────────────────────────────────┤
│ site-eu/portal │ :Service        │ default   │ portal-service  │ N/A     │ 2026-02-21 13:52:53 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
│ site-eu/portal │ :ConfigMap      │ default   │ regional-config │ N/A     │ 2026-02-21 13:52:53 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
│ site-eu/portal │ apps:Deployment │ default   │ customer-portal │ N/A     │ 2026-02-21 13:52:54 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
│ site-us/portal │ apps:Deployment │ default   │ customer-portal │ N/A     │ 2026-02-21 13:52:44 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
│ site-us/portal │ :Service        │ default   │ portal-service  │ N/A     │ 2026-02-21 13:52:43 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
│ site-us/portal │ :ConfigMap      │ default   │ regional-config │ N/A     │ 2026-02-21 13:52:44 +0100 CET │ Managed cluster │ ClusterProfile/deploy-portal-fleet │
└────────────────┴─────────────────┴───────────┴─────────────────┴─────────┴───────────────────────────────┴─────────────────┴────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The power of this approach is visible when we inspect the regional-config ConfigMap in both environments.&lt;/p&gt;

&lt;p&gt;Since the US cluster does not have a location: europe label, the patchesFrom directive (which was marked as optional: true) simply skips the patching process. The result is the exact "Gold Standard" manifest defined by the Global Team.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get configmap regional-config
NAME              DATA   AGE
regional-config   0      109s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the EU cluster, Sveltos detected the location: europe label. It dynamically resolved the patch name to portal-patch-europe and performed a JSON Patch at the moment of delivery.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get configmap regional-config
NAME              DATA   AGE
regional-config   1      106s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ultimate test of our &lt;strong&gt;Surgical Post-Processor&lt;/strong&gt; is what the end-user sees. By simply changing a label on the cluster, Sveltos has dynamically altered the application's behavior at the edge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gwcjviz2q2kya0jtuar.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gwcjviz2q2kya0jtuar.png" alt="Us Portal" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9d7v630wsqw768gg113.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9d7v630wsqw768gg113.png" alt="EU Portal" width="539" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling Without the Friction
&lt;/h2&gt;

&lt;p&gt;Multi-cluster management doesn't have to be a choice between "copy-paste" chaos and Helm-chart bloat. By shifting to a Surgical Post-Processing model with Sveltos, you decouple your global intent from local requirements.&lt;br&gt;
This "late-binding" approach ensures that your core application remains immutable and easy to update, while regional nuances - from compliance headers to security sidecars - are injected dynamically at the edge. The result is a GitOps workflow that finally scales as fast as your infrastructure.&lt;br&gt;
Stop forking your YAML and start orchestrating your intent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9g2ri397127t6b826w3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9g2ri397127t6b826w3u.png" alt="Comparison" width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s Connect
&lt;/h2&gt;

&lt;p&gt;Have questions or want to discuss the latest in tech? Instead of commenting here, let’s stay in touch on &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;. I’m always happy to network and share insights!&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Orchestrating Kubernetes Deployments Through Dependencies</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Tue, 18 Mar 2025 13:11:31 +0000</pubDate>
      <link>https://dev.to/gianlucam76/orchestrating-kubernetes-deployments-through-dependencies-3fn6</link>
      <guid>https://dev.to/gianlucam76/orchestrating-kubernetes-deployments-through-dependencies-3fn6</guid>
      <description>&lt;p&gt;In complex Kubernetes environments, deploying applications often involves intricate dependencies. Ensuring that components are installed in the correct order, and that required services are healthy before proceeding, is crucial for stability and reliability. Manually managing these dependencies becomes increasingly challenging as the number of applications and their interrelationships grow. This necessitates robust mechanisms for automating deployment sequences, verifying application health, and optimizing resource utilization to prevent redundant installations. Effective dependency management is vital for simplifying deployments, reducing operational overhead, and ensuring the smooth functioning of distributed applications within Kubernetes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sveltos Solution
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers operating within a management cluster. From this central point, Sveltos manages add-ons and applications across a fleet of managed Kubernetes clusters. It employs a declarative approach, ensuring that the desired state is consistently reflected across these managed environments.&lt;/p&gt;

&lt;p&gt;A Sveltos &lt;a href="https://raw.githubusercontent.com/projectsveltos/addon-controller/refs/heads/main/api/v1beta1/clusterprofile_types.go" rel="noopener noreferrer"&gt;ClusterProfile&lt;/a&gt;/&lt;a href="https://raw.githubusercontent.com/projectsveltos/addon-controller/refs/heads/main/api/v1beta1/profile_types.go" rel="noopener noreferrer"&gt;Profile&lt;/a&gt; is a bundle of Helm charts and Kubernetes resources that Sveltos will deploy to every cluster that matches its selection criteria.&lt;/p&gt;

&lt;p&gt;To simplify complex deployments, Sveltos allows you to create multiple profiles and specify a deployment order using the dependsOn field, ensuring all profile prerequisites are met.&lt;/p&gt;

&lt;p&gt;Consider deploying admission policies. Here are the relevant ClusterProfile snippets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;syncMode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Continuous&lt;/span&gt;
  &lt;span class="na"&gt;helmCharts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repositoryURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;https://kyverno.github.io/kyverno/&lt;/span&gt;
    &lt;span class="na"&gt;repositoryName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   &lt;span class="s"&gt;kyverno&lt;/span&gt;
    &lt;span class="na"&gt;chartName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;kyverno/kyverno&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;     &lt;span class="s"&gt;3.3.4&lt;/span&gt;
    &lt;span class="na"&gt;releaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      &lt;span class="s"&gt;kyverno-latest&lt;/span&gt;
    &lt;span class="na"&gt;releaseNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
    &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;admission-policies&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
  &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that the &lt;em&gt;kyverno&lt;/em&gt; ClusterProfile lacks a &lt;strong&gt;clusterSelector&lt;/strong&gt;, so it won't be deployed on its own. The &lt;em&gt;admission-policies&lt;/em&gt; ClusterProfile, however, has a &lt;strong&gt;clusterSelector&lt;/strong&gt; targeting production clusters and a &lt;strong&gt;dependsOn&lt;/strong&gt; field referencing &lt;em&gt;kyverno&lt;/em&gt;. When this profile is created, Sveltos resolves its dependency. Any time a production cluster matches the admission-policies selector, Sveltos will first deploy the Kyverno Helm chart and then apply the admission policies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feiwo2q772foqa5nnkjph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feiwo2q772foqa5nnkjph.png" alt="Kubernetes Application Dependencies" width="784" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond Order: Verifying Application Health
&lt;/h2&gt;

&lt;p&gt;While deployment order is a fundamental aspect of application dependencies, it’s not always the sole requirement. In the Kyverno example, we prioritize deploying the CRDs before the custom resources, focusing on sequence. But consider a scenario where an application relies on a database. The database must not only be deployed first but also be fully initialized and ready to accept connections. In such cases, the state of the dependency becomes critical. Dependency management tools must accommodate these more complex state-based requirements.&lt;/p&gt;

&lt;p&gt;Building on our Kyverno example, let’s address the need for state-based dependencies. We want to ensure that all Kyverno deployments are fully operational before deploying admission policies. To achieve this, we add a &lt;strong&gt;validateHealths&lt;/strong&gt; section to the kyverno ClusterProfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;syncMode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Continuous&lt;/span&gt;
  &lt;span class="na"&gt;helmCharts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repositoryURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;https://kyverno.github.io/kyverno/&lt;/span&gt;
    &lt;span class="na"&gt;repositoryName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   &lt;span class="s"&gt;kyverno&lt;/span&gt;
    &lt;span class="na"&gt;chartName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;kyverno/kyverno&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;     &lt;span class="s"&gt;3.3.4&lt;/span&gt;
    &lt;span class="na"&gt;releaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      &lt;span class="s"&gt;kyverno-latest&lt;/span&gt;
    &lt;span class="na"&gt;releaseNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
    &lt;span class="na"&gt;helmChartAction&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  &lt;span class="s"&gt;Install&lt;/span&gt;
    &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
      &lt;span class="s"&gt;admissionController:&lt;/span&gt;
        &lt;span class="s"&gt;replicas: 3&lt;/span&gt;
      &lt;span class="s"&gt;backgroundController:&lt;/span&gt;
        &lt;span class="s"&gt;replicas: 3&lt;/span&gt;
&lt;span class="na"&gt;validateHealths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deployment-health&lt;/span&gt;
  &lt;span class="na"&gt;featureID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Helm&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;apps"&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;v1"&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Deployment"&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;function evaluate()&lt;/span&gt;
      &lt;span class="s"&gt;hs = {}&lt;/span&gt;
      &lt;span class="s"&gt;hs.healthy = false&lt;/span&gt;
      &lt;span class="s"&gt;hs.message = "available replicas not matching requested replicas"&lt;/span&gt;
      &lt;span class="s"&gt;if obj.status ~= nil then&lt;/span&gt;
        &lt;span class="s"&gt;if obj.status.availableReplicas ~= nil then&lt;/span&gt;
          &lt;span class="s"&gt;if obj.status.availableReplicas == obj.spec.replicas then&lt;/span&gt;
            &lt;span class="s"&gt;hs.healthy = true&lt;/span&gt;
          &lt;span class="s"&gt;end&lt;/span&gt;
        &lt;span class="s"&gt;end&lt;/span&gt;
      &lt;span class="s"&gt;end&lt;/span&gt;
      &lt;span class="s"&gt;return hs&lt;/span&gt;
    &lt;span class="s"&gt;end      &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Recursive Resolution
&lt;/h2&gt;

&lt;p&gt;One of the key strengths of Sveltos is its ability to handle complex dependency chains. Imagine an application &lt;em&gt;whoami&lt;/em&gt; that relies on &lt;em&gt;Traefik&lt;/em&gt;, which itself depends on &lt;em&gt;cert-manager&lt;/em&gt;. With Sveltos, you only need to define the deployment of whoami. Sveltos will automatically resolve the entire dependency tree, ensuring &lt;em&gt;cert-manager&lt;/em&gt; and &lt;em&gt;Traefik&lt;/em&gt; are deployed in the correct order before &lt;em&gt;whoami&lt;/em&gt; is deployed. This simplifies complex deployments by automating the resolution of multi-level dependencies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftftlqyr1b9u257n0utle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftftlqyr1b9u257n0utle.png" alt="Dependency Chain" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This capability is especially valuable in environments where different administrators manage distinct components. For instance, the whoami application might be managed by the &lt;strong&gt;application&lt;/strong&gt; administrator, Traefik by the &lt;strong&gt;networking&lt;/strong&gt; administrator, and cert-manager by the &lt;strong&gt;security&lt;/strong&gt; administrator. Sveltos eliminates the need for manual coordination, allowing each administrator to focus on their respective components while ensuring the overall deployment succeeds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6sd4c4nglxw3h5drahj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6sd4c4nglxw3h5drahj.png" alt="Different Administrators" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://projectsveltos.github.io/sveltos/getting_started/optional/dashboard/" rel="noopener noreferrer"&gt;Sveltos Dashboard &lt;/a&gt;displays those dependencies:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flln9i25wp8ukjpn2ug5f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flln9i25wp8ukjpn2ug5f.png" alt="Sveltos Dashboard" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Dependency Deduplication
&lt;/h2&gt;

&lt;p&gt;Sveltos efficiently manages shared dependencies by ensuring they are deployed only once per cluster, even when multiple profiles rely on them. This optimizes resource utilization and prevents redundant deployments. Crucially, Sveltos maintains a dependency as long as any profile requiring it is active on the cluster.&lt;/p&gt;

&lt;p&gt;Consider a 3-tier application scenario:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Database Layer (Profile &lt;strong&gt;postgresql&lt;/strong&gt;): Deploys a PostgreSQL database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backend Layer (Profiles &lt;strong&gt;backend-service-1&lt;/strong&gt;, &lt;strong&gt;backend-service-2&lt;/strong&gt;): Two distinct microservices, each requiring the PostgreSQL database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Frontend Layer (Profiles &lt;strong&gt;frontend-app-1&lt;/strong&gt;, &lt;strong&gt;frontend-app-2&lt;/strong&gt;): Two frontend applications, each dependent on a respective backend service.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s how this translates to Sveltos profiles and dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Profile &lt;strong&gt;postgresql&lt;/strong&gt;: Deploys the PostgreSQL database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile &lt;strong&gt;backend-service-1&lt;/strong&gt;: Depends on Profile postgresql.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile &lt;strong&gt;frontend-app-1&lt;/strong&gt;: Depends on Profile backend-service-1.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile &lt;strong&gt;backend-service-2&lt;/strong&gt;: Depends on Profile postgresql.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile &lt;strong&gt;frontend-app-2&lt;/strong&gt;: Depends on Profile backend-service-2.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ld82dm1yad7fk9ii6rx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ld82dm1yad7fk9ii6rx.png" alt="Kubernetes Application Dependency Deduplication" width="800" height="648"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When &lt;strong&gt;frontend-app-1&lt;/strong&gt; is deployed, Sveltos first deploys &lt;strong&gt;postgresql&lt;/strong&gt; and then &lt;strong&gt;backend-service-1&lt;/strong&gt;, resolving the dependency chain.&lt;/p&gt;

&lt;p&gt;Subsequently, when &lt;strong&gt;frontend-app-2&lt;/strong&gt; is deployed to the same cluster, Sveltos recognizes that &lt;strong&gt;postgresql&lt;/strong&gt; is already present and avoids redeploying it.&lt;/p&gt;

&lt;p&gt;If &lt;strong&gt;frontend-app-1&lt;/strong&gt; is then removed, &lt;strong&gt;backend-service-1&lt;/strong&gt; is also removed. However, &lt;strong&gt;postgresql&lt;/strong&gt; persists because it remains a dependency of &lt;strong&gt;frontend-app-2&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Finally, only when &lt;strong&gt;frontend-app-2&lt;/strong&gt; is removed will Sveltos remove &lt;strong&gt;backend-service-2&lt;/strong&gt; and &lt;strong&gt;postgresql&lt;/strong&gt;, as they are no longer required by any active profile on the cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
   Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>devops</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Automating Kro Deployments Across Kubernetes Fleets</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Fri, 14 Mar 2025 12:43:20 +0000</pubDate>
      <link>https://dev.to/gianlucam76/automating-kro-deployments-across-kubernetes-fleets-id0</link>
      <guid>https://dev.to/gianlucam76/automating-kro-deployments-across-kubernetes-fleets-id0</guid>
      <description>&lt;p&gt;Deploying and managing complex applications across multiple Kubernetes clusters can be a daunting task. This tutorial demonstrates how to simplify this process using Kro, the Kube Resource Orchestrator, and Sveltos, a powerful multi-cluster management tool. We’ll walk through a practical example, showing you how to automate Kro deployments across your entire Kubernetes fleet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kro
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://kro.run/docs/overview" rel="noopener noreferrer"&gt;Kro&lt;/a&gt;, or Kube Resource Orchestrator, is an open-source Kubernetes project designed to simplify the deployment and management of complex applications on Kubernetes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2phghs3vzckghca2sk8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2phghs3vzckghca2sk8d.png" alt="Kro" width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kro’s installation introduces the &lt;strong&gt;ResourceGraphDefinition&lt;/strong&gt; CustomResourceDefinition, enabling teams to build custom APIs. By defining custom resources within the RGD, teams can create abstractions like &lt;em&gt;ApplicationStack&lt;/em&gt;, which encapsulate complex deployments. This simplifies Kubernetes for developers, who can then interact with high-level APIs instead of managing low-level resources.&lt;/p&gt;

&lt;p&gt;In the above example, the &lt;strong&gt;Platform Team&lt;/strong&gt; has created a Resource Group named &lt;em&gt;Application Stack&lt;/em&gt; that encapsulates the necessary resources, along with any additional logic, abstractions, and security best practices.&lt;/p&gt;

&lt;p&gt;When the ResourceGraphDefinition instance is applied to the cluster, a new API of kind ApplicationStack is created and available for Developer to interact with. The Developers no longer need to directly manage the underlying infrastructure complexities, as the custom API handles the deployment and configuration of the required resources.&lt;/p&gt;

&lt;p&gt;Using kro, the Platform Team can enable Developer teams to quickly deploy and manage applications and their dependencies as one unit, handling the entire lifecycle from deployment to maintenance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing a Fleet of Clusters
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; automates and scales Kro deployments across multiple clusters.&lt;/p&gt;

&lt;p&gt;Platform and security teams configure Kro and ResourceGroupDefinitions through ClusterProfiles, &lt;strong&gt;deferring&lt;/strong&gt; target cluster selection because at this stage they don’t know where the dependent applications will be deployed, and importantly, because Kro should only be deployed on clusters where it’s actually needed.&lt;/p&gt;

&lt;p&gt;Application admins, who possess the knowledge of application deployment locations, then create deployment-specific profiles, selecting target clusters and declaring dependencies on the pre-defined ResourceGroupDefinitions.&lt;/p&gt;

&lt;p&gt;Sveltos automates the process, identifying matching clusters, resolving dependencies, and deploying Kro, ResourceGroupDefinitions, and applications in the correct order across the matching clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fammokyls8dzk0kqft3u8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fammokyls8dzk0kqft3u8.png" alt="Sveltos and Kro" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Install Sveltos on Management Cluster
&lt;/h2&gt;

&lt;p&gt;Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this demo we will use helm, so while pointing to the management cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm repo add projectsveltos https://projectsveltos.github.io/helm-charts
helm repo update
helm install projectsveltos projectsveltos/projectsveltos -n projectsveltos - create-namespace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Register Managed Clusters with Sveltos
&lt;/h2&gt;

&lt;p&gt;For this tutorial, I’m using a &lt;em&gt;GKE&lt;/em&gt; cluster and an &lt;em&gt;EKS&lt;/em&gt; cluster as production environments, along with two &lt;em&gt;Civo&lt;/em&gt; clusters for staging.&lt;/p&gt;

&lt;p&gt;To register these clusters for Sveltos management, you’ll need their respective Kubeconfigs. Use the following commands, adjusting namespace, cluster name, Kubeconfig path, and labels accordingly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl register cluster --namespace=&amp;lt;namespace&amp;gt; --cluster=&amp;lt;cluster name&amp;gt; \
    --kubeconfig=&amp;lt;path to file with Kubeconfig&amp;gt; \
    --labels=env=production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl register cluster --namespace=&amp;lt;namespace&amp;gt; --cluster=&amp;lt;cluster name&amp;gt; \
    --kubeconfig=&amp;lt;path to file with Kubeconfig&amp;gt; \
    --labels=env=staging
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify all clusters are correctly registered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get sveltoscluster -A --show-labels
NAMESPACE   NAME       READY   VERSION               LABELS
civo        cluster1   true    v1.30.5+k3s1          env=staging,projectsveltos.io/k8s-version=v1.30.5,sveltos-agent=present
civo        cluster2   true    v1.29.8+k3s1          env=staging,projectsveltos.io/k8s-version=v1.29.8,sveltos-agent=present
eks         cluster    true    v1.31.6-eks-bc803b4   env=production,projectsveltos.io/k8s-version=v1.31.6,sveltos-agent=present
gke         cluster    true    v1.31.5-gke.1233000   env=production,projectsveltos.io/k8s-version=v1.31.5,sveltos-agent=present
mgmt        mgmt       true    v1.32.2               projectsveltos.io/k8s-version=v1.32.2,sveltos-agent=present
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Configuring Kro Deployment with a ClusterProfile
&lt;/h2&gt;

&lt;p&gt;This ClusterProfile configures Sveltos for Kro deployment, but intentionally omits a &lt;em&gt;clusterSelector&lt;/em&gt;. The platform administrator is deferring cluster selection until the specific need for Kro on managed clusters becomes clear.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy-kro&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;syncMode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Continuous&lt;/span&gt;
  &lt;span class="na"&gt;helmCharts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repositoryURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;oci://ghcr.io/kro-run/kro&lt;/span&gt;
    &lt;span class="na"&gt;repositoryName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   &lt;span class="s"&gt;kro&lt;/span&gt;
    &lt;span class="na"&gt;chartName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;kro&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;     &lt;span class="s"&gt;0.2.1&lt;/span&gt;
    &lt;span class="na"&gt;releaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      &lt;span class="s"&gt;kro&lt;/span&gt;
    &lt;span class="na"&gt;releaseNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kro&lt;/span&gt;
    &lt;span class="na"&gt;helmChartAction&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  &lt;span class="s"&gt;Install&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To apply this ClusterProfile to your management cluster, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/gianlucam76/devops-tutorial/refs/heads/main/kro/clusterprofile-deploy-kro.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Configuring Kro ResourceGroupDefinition with a ClusterProfile
&lt;/h2&gt;

&lt;p&gt;This ClusterProfile configures Sveltos to deploy the Kro ResourceGraphDefinition.&lt;/p&gt;

&lt;p&gt;It intentionally omits a &lt;em&gt;clusterSelector&lt;/em&gt;, as the target clusters are determined later when Kro’s necessity on managed clusters is known.&lt;/p&gt;

&lt;p&gt;Crucially, this profile also declares a &lt;strong&gt;dependency&lt;/strong&gt; on the &lt;em&gt;deploy-kro&lt;/em&gt; ClusterProfile, ensuring Kro is installed before the ResourceGraphDefinition.&lt;/p&gt;

&lt;p&gt;To apply this ClusterProfile to your management cluster, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/gianlucam76/devops-tutorial/refs/heads/main/kro/clusterprofile-deploy-resource-graph-defintion.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Configuring Kro Application with a ClusterProfile
&lt;/h2&gt;

&lt;p&gt;In this step, we’ll deploy a Kro application specifically to our staging clusters using a ClusterProfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy-kro-application-staging&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy-kro-resource-graph-defintion&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;staging&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, the &lt;strong&gt;clusterSelector&lt;/strong&gt; field targets clusters with the &lt;em&gt;env: staging&lt;/em&gt; label, ensuring the application is deployed only to those environments.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;dependsOn&lt;/strong&gt; field specifies that the &lt;em&gt;deploy-kro-resource-graph-defintion&lt;/em&gt; ClusterProfile must be applied first, guaranteeing the necessary ResourceGraphDefinition is in place.&lt;/p&gt;

&lt;p&gt;Sveltos handles the dependency resolution automatically, creating a Directed Acyclic Graph (DAG) to ensure all required profiles are deployed in the correct order to the selected staging clusters.&lt;/p&gt;

&lt;p&gt;To apply this ClusterProfile to your management cluster, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/gianlucam76/devops-tutorial/refs/heads/main/kro/clusterprofile-deploy-application-staging.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After applying the ClusterProfile, you can verify the deployment using &lt;strong&gt;sveltosctl show addons&lt;/strong&gt;. The output should resemble the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+
|    CLUSTER    |          RESOURCE TYPE          | NAMESPACE |          NAME           | VERSION |             TIME              |                      PROFILES                      |
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+
| civo/cluster1 | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:49:42 +0100 CET | ClusterProfile/deploy-kro                          |
| civo/cluster1 | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:49:50 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
| civo/cluster1 | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:50:07 +0100 CET | ClusterProfile/deploy-kro-application-staging      |
| civo/cluster2 | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:49:42 +0100 CET | ClusterProfile/deploy-kro                          |
| civo/cluster2 | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:49:56 +0100 CET | ClusterProfile/deploy-kro-application-staging      |
| civo/cluster2 | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:49:50 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This output confirms that Kro, the ResourceGraphDefinition, and the application have been successfully deployed to both civo/cluster1 and civo/cluster2, our staging clusters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Deploy Kro Application to production clusters
&lt;/h2&gt;

&lt;p&gt;Now, let’s extend our deployment to the production environments. We’ll use another ClusterProfile to deploy the Kro application to our production clusters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy-kro-application-production&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy-kro-resource-graph-defintion&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ClusterProfile, much like the staging one, uses a &lt;strong&gt;clusterSelector&lt;/strong&gt;. Here, it targets clusters with the label &lt;em&gt;env: production&lt;/em&gt;, ensuring the application is deployed only to your production clusters.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;dependsOn&lt;/strong&gt; field again ensures that the &lt;em&gt;deploy-kro-resource-graph-defintion&lt;/em&gt; ClusterProfile is deployed first, maintaining the correct deployment order.&lt;/p&gt;

&lt;p&gt;To apply this ClusterProfile to your management cluster, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/gianlucam76/devops-tutorial/refs/heads/main/kro/clusterprofile-deploy-application-production.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After applying the ClusterProfile, verify the deployment using &lt;strong&gt;sveltosctl show addons&lt;/strong&gt;. You should see the following output, confirming the application’s deployment to your production clusters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+
|    CLUSTER    |          RESOURCE TYPE          | NAMESPACE |          NAME           | VERSION |             TIME              |                      PROFILES                      |
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+
| civo/cluster1 | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:49:42 +0100 CET | ClusterProfile/deploy-kro                          |
| civo/cluster1 | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:50:07 +0100 CET | ClusterProfile/deploy-kro-application-staging      |
| civo/cluster1 | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:49:50 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
| civo/cluster2 | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:49:42 +0100 CET | ClusterProfile/deploy-kro                          |
| civo/cluster2 | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:49:56 +0100 CET | ClusterProfile/deploy-kro-application-staging      |
| civo/cluster2 | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:49:50 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
| eks/cluster   | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:52:43 +0100 CET | ClusterProfile/deploy-kro                          |
| eks/cluster   | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:53:04 +0100 CET | ClusterProfile/deploy-kro-application-production   |
| eks/cluster   | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:52:51 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
| gke/cluster   | helm chart                      | kro       | kro                     | 0.2.1   | 2025-03-12 13:52:43 +0100 CET | ClusterProfile/deploy-kro                          |
| gke/cluster   | kro.run:ResourceGraphDefinition |           | my-application          | N/A     | 2025-03-12 13:52:50 +0100 CET | ClusterProfile/deploy-kro-resource-graph-defintion |
| gke/cluster   | kro.run:Application             | default   | my-application-instance | N/A     | 2025-03-12 13:53:04 +0100 CET | ClusterProfile/deploy-kro-application-production   |
+---------------+---------------------------------+-----------+-------------------------+---------+-------------------------------+----------------------------------------------------+

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, the application has now been deployed to both eks/cluster and gke/cluster, our production environments, in addition to the existing staging deployments.&lt;/p&gt;

&lt;p&gt;If you have also deployed &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/optional/dashboard/" rel="noopener noreferrer"&gt;Sveltos dashboard&lt;/a&gt;, you can see it to display all managed clusters and all resources deployed in each managed cluster:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsc8p9o9h4ual0f5hemr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqsc8p9o9h4ual0f5hemr.png" alt="Sveltos dashboard" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we’ve demonstrated how Sveltos simplifies the deployment and management of Kro applications across a fleet of Kubernetes clusters. By leveraging ClusterProfiles, we were able to deploy Kro and its associated resources in a staged and controlled manner, first setting up the foundational components and then deploying applications to specific environments based on their requirements.&lt;/p&gt;

&lt;p&gt;Sveltos’s ability to defer target cluster selection and resolve dependencies allowed us to efficiently manage Kro deployments, ensuring that resources were only deployed to the clusters where they were needed. We showcased how to target staging and production environments using clusterSelector and how to maintain the correct deployment order using dependsOn.&lt;/p&gt;

&lt;p&gt;Beyond what we’ve covered here, Sveltos offers even greater flexibility. It can also be used to deploy Kro applications in response to events occurring in the managed clusters.&lt;/p&gt;

&lt;p&gt;This event-driven capability allows for dynamic and automated deployments, enabling you to react to changes in your environment in real-time. This opens up possibilities for sophisticated automation,such as scaling applications based on resource utilization or deploying specific configurations in response to security alerts.&lt;/p&gt;

&lt;p&gt;By combining the power of Kro for application orchestration with Sveltos for fleet management and event-driven automation, you can significantly streamline your Kubernetes operations and achieve greater efficiency and reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>devops</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Click-to-Cluster: GitOps EKS Provisioning</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Tue, 04 Mar 2025 13:49:25 +0000</pubDate>
      <link>https://dev.to/gianlucam76/click-to-cluster-gitops-eks-provisioning-djj</link>
      <guid>https://dev.to/gianlucam76/click-to-cluster-gitops-eks-provisioning-djj</guid>
      <description>&lt;p&gt;Imagine a scenario where you need to provide dedicated Kubernetes environments to individual users or teams on demand. Manually creating and managing these clusters can be time-consuming and error-prone. In this tutorial, we'll demonstrate how to automate this process using a powerful combination of ArgoCD, Sveltos, and ClusterAPI. We'll set up a GitOps workflow where adding a new user via a pull request triggers the automatic provisioning of a dedicated EKS cluster. ArgoCD will maintain the desired state of our management cluster, Sveltos will detect changes and orchestrate cluster creation, and ClusterAPI will handle the provisioning of the EKS clusters. This tutorial will provide a hands-on experience in building a robust and scalable cluster provisioning pipeline.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33aoqwd7nr4gl0w7gyqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33aoqwd7nr4gl0w7gyqj.png" alt="ArgoCD, Sveltos and ClusterAPI" width="800" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Argo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi85rw80suwi5tpl4fldf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi85rw80suwi5tpl4fldf.png" alt="ArgoCD" width="106" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/argoproj/argo-cd" rel="noopener noreferrer"&gt;Argo CD&lt;/a&gt; is an open-source, continuous delivery (CD) tool for Kubernetes that automates the deployment, monitoring, and rollback of applications. It is a declarative tool that uses GitOps principles to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes Management or Workload cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sveltos
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdc0cax08ggaeu6wtzqdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdc0cax08ggaeu6wtzqdt.png" alt="Sveltos" width="106" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers operating within a management cluster. From this central point, Sveltos manages add-ons and applications across a fleet of managed Kubernetes clusters. It employs a declarative approach, ensuring that the desired state is consistently reflected across these managed environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  ClusterAPI
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xa2f8y35d1ttgfkp83d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xa2f8y35d1ttgfkp83d.png" alt="ClusterAPI" width="106" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/kubernetes-sigs/cluster-api" rel="noopener noreferrer"&gt;ClusterAPI&lt;/a&gt; (CAPI) is a Kubernetes sub-project that brings declarative, Kubernetes-style APIs to cluster creation, configuration, and management. It allows you to manage the lifecycle of Kubernetes clusters using the same declarative approach you use for managing applications.&lt;/p&gt;

&lt;h2&gt;
  
  
   Step 1: Install ClusterAPI on Management Cluster
&lt;/h2&gt;

&lt;p&gt;We'll use a Kind cluster as our management cluster. To begin, we need to deploy ClusterAPI with the AWS infrastructure provider.&lt;br&gt;
First, configure your AWS credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_ACCESS_KEY_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;YOUR ACCESS KEY&amp;gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_SECRET_ACCESS_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;YOUR SECRET ACCESS KEY&amp;gt;
clusterawsadm bootstrap iam create-cloudformation-stack &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_B64ENCODED_CREDENTIALS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;clusterawsadm bootstrap credentials encode-as-profile&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, initialize ClusterAPI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;EKS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true
export &lt;/span&gt;&lt;span class="nv"&gt;EXP_MACHINE_POOL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true
export &lt;/span&gt;&lt;span class="nv"&gt;CAPA_EKS_IAM&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true
export &lt;/span&gt;&lt;span class="nv"&gt;AWS_CONTROL_PLANE_MACHINE_TYPE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;t3.large
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_NODE_MACHINE_TYPE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;t3.large
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_SSH_KEY_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;capi-eks
clusterctl init &lt;span class="nt"&gt;--infrastructure&lt;/span&gt; aws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Install ArgoCD on Management Cluster
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl create namespace argocd
kubectl apply &lt;span class="nt"&gt;-n&lt;/span&gt; argocd &lt;span class="nt"&gt;-f&lt;/span&gt; https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl config set-context &lt;span class="nt"&gt;--current&lt;/span&gt; &lt;span class="nt"&gt;--namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;argocd
kubectl port-forward svc/argocd-server &lt;span class="nt"&gt;-n&lt;/span&gt; argocd 8080:443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The admin password to connect to ArgoCD dashboard is in the Secret named &lt;code&gt;argocd-initial-admin-secret&lt;/code&gt; in the argocd namespace.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Deploy Sveltos
&lt;/h2&gt;

&lt;p&gt;We will leverage Argo CD to automate the deployment of Sveltos onto your management Kubernetes cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;argocd app create sveltos &lt;span class="nt"&gt;--repo&lt;/span&gt; https://github.com/projectsveltos/helm-charts.git &lt;span class="nt"&gt;--path&lt;/span&gt; charts/projectsveltos &lt;span class="nt"&gt;--dest-server&lt;/span&gt; https://kubernetes.default.svc &lt;span class="nt"&gt;--dest-namespace&lt;/span&gt; projectsveltos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This directs Argo CD to create an application named sveltos, retrieving the Sveltos Helm chart from the specified GitHub repository and deploying it to the &lt;code&gt;projectsveltos&lt;/code&gt; namespace within the management cluster. Next, we'll deploy the Sveltos configurations using Argo CD.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;argocd app create sveltos-configuration &lt;span class="nt"&gt;--repo&lt;/span&gt; https://github.com/gianlucam76/devops-tutorial.git &lt;span class="nt"&gt;--path&lt;/span&gt; argocd-sveltos-clusterapi-eks &lt;span class="nt"&gt;--dest-server&lt;/span&gt; https://kubernetes.default.svc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Sveltos configuration we're deploying establishes a dynamic cluster creation process. First, it monitors a ConfigMap named &lt;code&gt;existing-users&lt;/code&gt; within the default namespace. This ConfigMap maintains a list of users, each entry formatted as &lt;code&gt;user-id: cluster-type&lt;/code&gt;, where cluster-type designates either &lt;code&gt;production&lt;/code&gt; or &lt;code&gt;staging&lt;/code&gt;. Subsequently, whenever a new user entry is detected in this ConfigMap, Sveltos triggers the deployment of a ClusterAPI configuration, which in turn initiates the creation of a new EKS cluster. Importantly, each newly created cluster will be labeled with type:cluster-type, allowing Sveltos to immediately apply the appropriate configuration, whether for production or staging environments, based on the cluster's label.&lt;/p&gt;

&lt;p&gt;Before we proceed further, label the management cluster with &lt;code&gt;type: mgmt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl label sveltoscluster &lt;span class="nt"&gt;-n&lt;/span&gt; mgmt mgmt &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mgmt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Push a PR to add a new user
&lt;/h2&gt;

&lt;p&gt;To add a new user and trigger the creation of a corresponding EKS cluster, we will implement a straightforward GitOps workflow. First, we'll submit a pull request (PR) that modifies the &lt;code&gt;existing-users.yaml&lt;/code&gt; ConfigMap within our repository. Specifically, this PR will introduce a new user entry, &lt;code&gt;user1: production&lt;/code&gt;, within the data section of the ConfigMap, as shown in the provided diff.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gh"&gt;diff --git a/argocd-sveltos-clusterapi-eks/existing-users.yaml b/argocd-sveltos-clusterapi-eks/existing-users.yaml
index ab0d862..10987b3 100644
&lt;/span&gt;&lt;span class="gd"&gt;--- a/argocd-sveltos-clusterapi-eks/existing-users.yaml
&lt;/span&gt;&lt;span class="gi"&gt;+++ b/argocd-sveltos-clusterapi-eks/existing-users.yaml
&lt;/span&gt;&lt;span class="p"&gt;@@ -3,3 +3,5 @@&lt;/span&gt; kind: ConfigMap
 metadata:
   name: existing-users
   namespace: default
&lt;span class="gi"&gt;+data:
+  user1: production
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the PR is merged, we'll then instruct Argo CD to synchronize these changes to the management cluster. This synchronization will apply the updated ConfigMap, thereby signaling Sveltos to initiate the ClusterAPI-driven provisioning of a new production EKS cluster for &lt;em&gt;user1&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9pfgun5hkyft3u5jgl2q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9pfgun5hkyft3u5jgl2q.gif" alt="ArgoCD, Sveltos and ClusterAPI: on demand creation of EKS clusters" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Sveltos triggers creation of a new EKS cluster
&lt;/h2&gt;

&lt;p&gt;Sveltos will immediately detect the new user entry, &lt;code&gt;user1: production&lt;/code&gt;. This detection triggers Sveltos to deploy all the necessary ClusterAPI resources to the management cluster, effectively orchestrating the creation of a new EKS cluster. Executing sveltosctl show addons will then reveal the deployed resources, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sveltosctl show addons
+-----------+-------------------------------------------------------+-----------+------------------------------+---------+-------------------------------+---------------------------------+
|  CLUSTER  |                     RESOURCE TYPE                     | NAMESPACE |             NAME             | VERSION |             TIME              |            PROFILES             |
+-----------+-------------------------------------------------------+-----------+------------------------------+---------+-------------------------------+---------------------------------+
| mgmt/mgmt | cluster.x-k8s.io:Cluster                              | user1     | capi-eks-user1               | N/A     | 2025-03-04 12:10:02 +0100 CET | ClusterProfile/deploy-resources |
| mgmt/mgmt | infrastructure.cluster.x-k8s.io:AWSManagedCluster     | user1     | capi-eks-user1               | N/A     | 2025-03-04 12:10:02 +0100 CET | ClusterProfile/deploy-resources |
| mgmt/mgmt | controlplane.cluster.x-k8s.io:AWSManagedControlPlane  | user1     | capi-eks-control-plane-user1 | N/A     | 2025-03-04 12:10:02 +0100 CET | ClusterProfile/deploy-resources |
| mgmt/mgmt | cluster.x-k8s.io:MachinePool                          | user1     | capi-eks-pool-0-user1        | N/A     | 2025-03-04 12:10:02 +0100 CET | ClusterProfile/deploy-resources |
| mgmt/mgmt | infrastructure.cluster.x-k8s.io:AWSManagedMachinePool | user1     | capi-eks-pool-0-user1        | N/A     | 2025-03-04 12:10:02 +0100 CET | ClusterProfile/deploy-resources |
+-----------+-------------------------------------------------------+-----------+------------------------------+---------+-------------------------------+---------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sveltos dashboard can also be used to see what Sveltos has deployed to the management cluster:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjkeiwt34cc8itqhim1ti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjkeiwt34cc8itqhim1ti.png" alt="Sveltos Dashboard" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Sveltos deploys production policies
&lt;/h2&gt;

&lt;p&gt;Once ClusterAPI completes the provisioning of the new EKS cluster, Sveltos will automatically deploy the add-ons configured for a production environment. This deployment includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The cert-manager Helm chart, to manage and issue TLS certificates.&lt;/li&gt;
&lt;li&gt;The kyverno Helm chart, for policy-based control of Kubernetes resources.&lt;/li&gt;
&lt;li&gt;The prometheus and grafana Helm charts, to provide monitoring and visualization capabilities.&lt;/li&gt;
&lt;li&gt;A kyverno admission policy specifically configured to disallow-latest-tag, enforcing the use of explicit image tags for container deployments.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sveltosctl show addons &lt;span class="nt"&gt;--namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;user1
+----------------------+--------------------------+--------------+---------------------+---------+-------------------------------+------------------------------------------+
|       CLUSTER        |      RESOURCE TYPE       |  NAMESPACE   |        NAME         | VERSION |             TIME              |                 PROFILES                 |
+----------------------+--------------------------+--------------+---------------------+---------+-------------------------------+------------------------------------------+
| user1/capi-eks-user1 | helm chart               | cert-manager | cert-manager        | v1.16.3 | 2025-03-04 12:28:00 +0100 CET | ClusterProfile/deploy-cert-manager       |
| user1/capi-eks-user1 | helm chart               | prometheus   | prometheus          | 26.0.0  | 2025-03-04 12:29:20 +0100 CET | ClusterProfile/prometheus-grafana        |
| user1/capi-eks-user1 | helm chart               | grafana      | grafana             | 8.6.4   | 2025-03-04 12:29:29 +0100 CET | ClusterProfile/prometheus-grafana        |
| user1/capi-eks-user1 | helm chart               | kyverno      | kyverno-latest      | 3.3.4   | 2025-03-04 12:28:50 +0100 CET | ClusterProfile/deploy-kyverno-production |
| user1/capi-eks-user1 | kyverno.io:ClusterPolicy |              | disallow-latest-tag | N/A     | 2025-03-04 12:29:19 +0100 CET | ClusterProfile/deploy-kyverno-resources  |
+----------------------+--------------------------+--------------+---------------------+---------+-------------------------------+------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also view deployed Helm charts within the Sveltos dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbz1m5w9kheig6amcr84w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbz1m5w9kheig6amcr84w.png" alt="Sveltos Dashboard" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Removing user
&lt;/h2&gt;

&lt;p&gt;Just as easily as we created a cluster by adding a user, we can remove a user and, consequently, delete their associated EKS cluster. This is achieved through the same GitOps workflow, but in reverse.&lt;/p&gt;

&lt;p&gt;To remove a user, we simply submit a pull request (PR) that removes the user's entry from the &lt;code&gt;existing-users.yaml&lt;/code&gt; ConfigMap. For example, to remove &lt;code&gt;user1&lt;/code&gt;, we would revert the changes we made in Step 4. Once this PR is merged and Argo CD synchronizes the changes to the management cluster, Sveltos detects the removal of the user from the ConfigMap.&lt;/p&gt;

&lt;p&gt;Sveltos, upon detecting this change, proceeds to delete all the ClusterAPI resources it previously deployed for that user. This includes the &lt;code&gt;Cluster&lt;/code&gt;, &lt;code&gt;AWSManagedCluster&lt;/code&gt;, &lt;code&gt;AWSManagedControlPlane&lt;/code&gt;, &lt;code&gt;MachinePool&lt;/code&gt;, and &lt;code&gt;AWSManagedMachinePool&lt;/code&gt; resources within the user's namespace (in this case, "user1").&lt;/p&gt;

&lt;p&gt;Because ClusterAPI operates declaratively, deleting these ClusterAPI resources triggers the deletion of the underlying EKS cluster. ClusterAPI's AWS infrastructure provider interprets the removal of these resources as a request to terminate the corresponding cloud resources.&lt;/p&gt;

&lt;p&gt;Therefore, by simply removing the user entry from the existing-users.yaml ConfigMap and allowing Argo CD and Sveltos to synchronize the changes, we effectively automate the entire lifecycle of the EKS cluster, from creation to deletion. This ensures that resources are efficiently managed and that orphaned clusters are avoided, maintaining a clean and cost-effective environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we've demonstrated how to build a fully automated, GitOps-driven pipeline for provisioning dedicated EKS clusters on demand. By leveraging the power of Argo CD, Sveltos, and ClusterAPI, we've established a robust and scalable solution that eliminates the manual effort and potential errors associated with traditional cluster management.&lt;br&gt;
We've seen how:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Argo CD&lt;/strong&gt; maintains the desired state of our management cluster, ensuring that all configurations are synchronized with our Git repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sveltos&lt;/strong&gt; acts as a dynamic orchestrator, detecting changes in our user configuration and triggering the creation of new EKS clusters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ClusterAPI&lt;/strong&gt; handles the heavy lifting of provisioning and managing the EKS clusters themselves, providing a consistent and declarative approach.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don't use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>opensource</category>
      <category>devops</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Orchestrating Secrets Across Kubernetes Clusters: Precision and Automation</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Mon, 03 Mar 2025 08:38:10 +0000</pubDate>
      <link>https://dev.to/gianlucam76/orchestrating-secrets-across-kubernetes-clusters-precision-and-automation-1123</link>
      <guid>https://dev.to/gianlucam76/orchestrating-secrets-across-kubernetes-clusters-precision-and-automation-1123</guid>
      <description>&lt;p&gt;Secrets, like API keys, passwords, and certificates, are critical confidential data. Centralized secret management across Kubernetes clusters offers key benefits: improved visibility, simplified updates, and enhanced security. By managing secrets in one location, you gain a clear overview, automate updates to all clusters, and can quickly isolate compromised clusters by revoking their access through label changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Sveltos?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Distrubute Secret to all Production clusters
&lt;/h2&gt;

&lt;p&gt;Sveltos is used to manage four Kubernetes clusters: EKS, GKE, Civo, and an on-premises deployment. The EKS, GKE, and Civo clusters share the label &lt;em&gt;env: production&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;A secret created in the management cluster is then distributed by Sveltos to the production clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnk5ioq5t526kroe5kn7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnk5ioq5t526kroe5kn7.gif" alt="Sveltos: Distribute Secret to all production clusters" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create Secret&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create secret generic -n default login-credential --from-literal=username=admin --from-literal=password=mypassword
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Post the Sveltos configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy-resources&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# Deploy to all cluster with label env: production&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
  &lt;span class="na"&gt;templateResourceRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# Fetch the Secret from the management cluster&lt;/span&gt;
      &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;login-credentials&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;identifier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Credentials&lt;/span&gt;
  &lt;span class="na"&gt;policyRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# Use this ConfigMap as a template and deploy its content, populating it with data from the referenced Secret.&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;info&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;info&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;projectsveltos.io/template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;true"&lt;/span&gt;  &lt;span class="c1"&gt;# add annotation to indicate Sveltos content is a template&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secret.yaml&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;{{ copy "Credentials" }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This YAML configuration tells Sveltos to perform three actions. First, it fetches the &lt;em&gt;login-credentials&lt;/em&gt; Secret from the &lt;em&gt;default&lt;/em&gt; namespace. Second, it takes the &lt;em&gt;info&lt;/em&gt; ConfigMap from the &lt;em&gt;default&lt;/em&gt; namespace, uses it as a template, and deploys the instantiated content using data from the &lt;em&gt;login-credentials&lt;/em&gt; Secret. Finally, it deploys the login-credentials Secret to all Kubernetes clusters with the &lt;em&gt;env: production&lt;/em&gt; label.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automating Secret Deployment with Event-Based Triggers
&lt;/h2&gt;

&lt;p&gt;Imagine you have a multi-cluster Kubernetes environment where different teams or applications need access to specific secrets. Instead of manually deploying these secrets to each cluster or pre-provisioning them, you want a more dynamic and automated approach.&lt;/p&gt;

&lt;p&gt;By using Sveltos to monitor for events like the creation of namespaces with certain labels (e.g., &lt;em&gt;credentials: required&lt;/em&gt;), you can automatically trigger the deployment of relevant secrets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5z4d91q3bmncx0tmyhy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu5z4d91q3bmncx0tmyhy.gif" alt="Sveltos: Deploy Secret in response to events" width="800" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lib.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;EventSource&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;requiring-credentials&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;collectResources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;resourceSelectors&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
    &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;v1"&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Namespace"&lt;/span&gt;
    &lt;span class="na"&gt;labelFilters&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;credentials&lt;/span&gt;
      &lt;span class="na"&gt;operation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Equal&lt;/span&gt;
      &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;required&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lib.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;EventTrigger&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;distribute-credentials&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sourceClusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
  &lt;span class="na"&gt;eventSourceName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;requiring-credentials&lt;/span&gt;
  &lt;span class="na"&gt;templateResourceRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;login-credentials&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;identifier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Credentials&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# This refers to the resource that Sveltos dynamically generates using ConfigMapGenerator.&lt;/span&gt;
      &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.Cluster.metadata.namespace&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}-{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.Cluster.metadata.name&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}-namespaces"&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;projectsveltos&lt;/span&gt;
    &lt;span class="na"&gt;identifier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Namespaces&lt;/span&gt;
  &lt;span class="na"&gt;configMapGenerator&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;namespaces&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;nameFormat&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.Cluster.metadata.namespace&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}-{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;.Cluster.metadata.name&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}-namespaces"&lt;/span&gt;
  &lt;span class="na"&gt;policyRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;info&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;namespaces&lt;/span&gt; 
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;projectsveltos.io/instantiate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;true"&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;namespaces&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;{{- range $v := .MatchingResources }}&lt;/span&gt;
       &lt;span class="s"&gt;{{ $v.Name }}: "ok"&lt;/span&gt;
    &lt;span class="s"&gt;{{- end }} &lt;/span&gt;
&lt;span class="s"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;info&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;projectsveltos.io/template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;true"&lt;/span&gt;  &lt;span class="c1"&gt;# add annotation to indicate Sveltos content is a template&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secret.yaml&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;{{ $namespaces := ( ( index (getResource "Namespaces").data "namespaces" ) | fromYaml ) }}&lt;/span&gt;
    &lt;span class="s"&gt;{{- range $key, $value := $namespaces }}&lt;/span&gt;
        &lt;span class="s"&gt;apiVersion: v1&lt;/span&gt;
        &lt;span class="s"&gt;kind: Secret&lt;/span&gt;
        &lt;span class="s"&gt;metadata:&lt;/span&gt;
          &lt;span class="s"&gt;namespace: {{ $key }}&lt;/span&gt;
          &lt;span class="s"&gt;name: {{ (getResource "Credentials").metadata.name }}&lt;/span&gt;
        &lt;span class="s"&gt;data:&lt;/span&gt;
          &lt;span class="s"&gt;{{- range $secretKey, $secretValue := (getResource "Credentials").data }}&lt;/span&gt;
            &lt;span class="s"&gt;{{ $secretKey }} : {{ $secretValue }}&lt;/span&gt;
          &lt;span class="s"&gt;{{- end }}&lt;/span&gt;
    &lt;span class="s"&gt;---&lt;/span&gt;
    &lt;span class="s"&gt;{{- end }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Sveltos configuration automates the targeted deployment of the &lt;em&gt;login-credentials&lt;/em&gt; secret. It monitors your production Kubernetes clusters for the creation of new namespaces labeled &lt;em&gt;credentials: required&lt;/em&gt;. Upon detection, Sveltos automatically deploys the &lt;em&gt;login-credentials&lt;/em&gt; secret into those specific namespaces.&lt;/p&gt;

&lt;p&gt;This allows for dynamic, targeted, and automated secret distribution, ensuring that secrets are only deployed where and when they are needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also star &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;/p&gt;

&lt;p&gt;Thank you for reading!&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>showdev</category>
      <category>automation</category>
    </item>
    <item>
      <title>Kubernetes on Autopilot: Event-Driven Automation Across Clusters</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Thu, 06 Feb 2025 15:16:51 +0000</pubDate>
      <link>https://dev.to/gianlucam76/kubernetes-on-autopilot-event-driven-automation-across-clusters-5co3</link>
      <guid>https://dev.to/gianlucam76/kubernetes-on-autopilot-event-driven-automation-across-clusters-5co3</guid>
      <description>&lt;p&gt;In today’s dynamic cloud environments, managing Kubernetes resources across multiple clusters can be a complex task. Traditional methods often lack the agility and event-driven architecture needed to respond quickly to changes and automate resource provisioning. This article explores how &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt;, in conjunction with &lt;a href="https://nats.io/" rel="noopener noreferrer"&gt;NATS&lt;/a&gt; and JetStream, simplifies multi-cluster Kubernetes management through event-driven automation, streamlining operations and improving responsiveness.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Sveltos
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers operating within a management cluster. From this central point, Sveltos manages add-ons and applications across a fleet of managed Kubernetes clusters. It employs a declarative approach, ensuring that the desired state is consistently reflected across these managed environments.&lt;/p&gt;

&lt;p&gt;Within the management cluster, each managed Kubernetes cluster is represented by a dedicated resource, to which labels can be attached. Sveltos leverages &lt;em&gt;cluster selectors&lt;/em&gt;, essentially label-based filters, to target specific groups of managed clusters for configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1p9ncn08kl67l2y132dk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1p9ncn08kl67l2y132dk.png" alt="Sveltos: Kubernetes add-on distribution" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is NATS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://nats.io/" rel="noopener noreferrer"&gt;NATS&lt;/a&gt; is a lightweight, high-performance messaging system optimized for speed and scalability. It excels at publish/subscribe communication. &lt;a href="https://docs.nats.io/nats-concepts/jetstream" rel="noopener noreferrer"&gt;JetStream&lt;/a&gt; enhances NATS with robust streaming and data management features, including message persistence, flow control, and ordered delivery, creating a powerful platform for modern distributed systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sveltos Event Framework: Expanding Beyond Kubernetes with NATS
&lt;/h2&gt;

&lt;p&gt;Sveltos offers an event-driven workflow: define events, select target clusters, and specify the add-ons/applications to deploy when those events occur. (see the &lt;a href="https://projectsveltos.github.io/sveltos/events/addon_event_deployment/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; and &lt;a href="https://www.youtube.com/watch?v=4mOWuOF0gWY" rel="noopener noreferrer"&gt;video&lt;/a&gt; by Colin for more details.)&lt;/p&gt;

&lt;p&gt;Initially, Sveltos’s event framework focused on monitoring Kubernetes resources &lt;em&gt;within&lt;/em&gt; the managed clusters, enabling automated responses to changes in those resources. However, with its NATS integration, Sveltos now supports a significantly expanded event horizon. It can now also react to events originating &lt;em&gt;outside&lt;/em&gt; the Kubernetes environment. This allows Sveltos to respond to a much wider range of triggers, including events from external systems, applications, and even manual interactions, dramatically increasing its automation and integration capabilities.&lt;/p&gt;

&lt;p&gt;Sveltos can connect to a NATS server and listen for CloudEvents published on NATS subjects. When a CloudEvent is received, Sveltos can automatically deploy or manage other Kubernetes resources in response to. Consider user authentication: a successful login (published as a CloudEvent) can trigger Sveltos to automatically create a user-specific namespace. Similarly, a logout event can initiate automated cleanup within the cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Setup
&lt;/h2&gt;

&lt;p&gt;A Kind cluster is used as management cluster. Then two extra Civo clusters all with label &lt;em&gt;env=production&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------------------+-------------+-------------------------------------+
|    Cluster Name        |   Version   |             Comments                |
+------------------------+-------------+-------------------------------------+
|    civo/cluster1       | v1.29.8+k3s1| Civo 3 Node - Medium Standard       |
|    civo/cluster2       | v1.30.5+k3s1| Civo 3 Node - Medium Standard       |
+------------------------+-------------+-------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1: Install Sveltos on Managament Cluster
&lt;/h2&gt;

&lt;p&gt;For this tutorial, we will install Sveltos in the management cluster. Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.46.1/manifest/manifest.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.46.1/manifest/default-classifier.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Register Clusters with Sveltos
&lt;/h2&gt;

&lt;p&gt;Using Civo UI, download the Kubeconfigs, then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create ns civo
sveltosctl register cluster --namespace=civo --cluster=cluster1 --kubeconfig=civo-cluster1-kubeconfig --labels=env=production
sveltosctl register cluster --namespace=civo --cluster=cluster2 --kubeconfig=civo-cluster2-kubeconfig --labels=env=production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your Civo clusters were successfully registered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get sveltoscluster -A --show-labels
NAMESPACE   NAME       READY   VERSION        LABELS
civo        cluster1   true    v1.29.8+k3s1   env=production,projectsveltos.io/k8s-version=v1.29.8,sveltos-agent=present
civo        cluster2   true    v1.30.5+k3s1   env=production,projectsveltos.io/k8s-version=v1.30.5,sveltos-agent=present
mgmt        mgmt       true    v1.31.2        projectsveltos.io/k8s-version=v1.31.2,sveltos-agent=present
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Deploy NATS in every production cluster
&lt;/h2&gt;

&lt;p&gt;Use a Sveltos &lt;em&gt;ClusterProfile&lt;/em&gt; to deploy NATS (version 1.2.9) to all production clusters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterProfile
metadata:
  name: nats
spec:
  clusterSelector:
    matchLabels:
      env: production
  helmCharts:
  - chartName: nats/nats
    chartVersion: 1.2.9
    helmChartAction: Install
    releaseName: nats
    releaseNamespace: nats
    repositoryName: nats
    repositoryURL: https://nats-io.github.io/k8s/helm/charts/
    values: |-
      config:
        merge:
          authorization:
            default_permissions:
              publish: ["&amp;gt;"]
              subscribe:  ["&amp;gt;"]
            users:
            - user: "admin"
              password: "my-password"
  syncMode: Continuous
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mpn859647vpt2ymthi9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mpn859647vpt2ymthi9.png" alt="Sveltos: Deploy NATS to every production cluster" width="800" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Instruct Sveltos to connect to NATS server
&lt;/h2&gt;

&lt;p&gt;A separate ClusterProfile then configures Sveltos to establish a connection to the deployed NATS server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: config.projectsveltos.io/v1beta1
kind: ClusterProfile
metadata:
  name: deploy-deploy-sveltos-nats-secret
spec:
  dependsOn:
  - nats
  clusterSelector:
    matchLabels:      
      env: production
  policyRefs:
  - name: deploy-sveltos-nats-secret
    namespace: default
    kind: Secret
---
apiVersion: v1
data:
  sveltos-nats: YXBpVmVyc2lvbjogdjEKZGF0YToKICBzdmVsdG9zLW5hdHM6IGV3b2dJQ0p1WVhSeklqb0tJQ0FnZXdvZ0lDQWdJQ0pqYjI1bWFXZDFjbUYwYVc5dUlqb0tDWHNLQ1NBZ0lDQWlkWEpzSWpvZ0ltNWhkSE02THk5dVlYUnpMbTVoZEhNdWMzWmpMbU5zZFhOMFpYSXViRzlqWVd3Nk5ESXlNaUlzQ2drZ0lDQWdJbk4xWW1wbFkzUnpJam9nV3dvSkNTSjFjMlZ5TFc5d1pYSmhkR2x2YmlJS0NTQWdJQ0JkTEFvSklDQWdJQ0poZFhSb2IzSnBlbUYwYVc5dUlqb2dld29KQ1NKMWMyVnlJam9nZXdvSkNTQWdJQ0FpZFhObGNpSTZJQ0poWkcxcGJpSXNDZ2tKSUNBZ0lDSndZWE56ZDI5eVpDSTZJQ0p0ZVMxd1lYTnpkMjl5WkNJS0NRbDlDZ2tnSUNBZ2ZRb0pmUW9nSUNCOUNuMEsKa2luZDogU2VjcmV0Cm1ldGFkYXRhOgogIG5hbWU6IHN2ZWx0b3MtbmF0cwogIG5hbWVzcGFjZTogcHJvamVjdHN2ZWx0b3MKdHlwZTogT3BhcXVlCg==
kind: Secret
metadata:
  name: deploy-sveltos-nats-secret
  namespace: default
type: addons.projectsveltos.io/cluster-profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fulrs8958x6pqilzjoec1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fulrs8958x6pqilzjoec1.png" alt="Sveltos connects to NATS server and respond to CloudEvents published on NATS subjects" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Automate namespace creation on user login
&lt;/h2&gt;

&lt;p&gt;Sveltos is configured to listen on the &lt;em&gt;user-operation&lt;/em&gt; NATS subject. When a user login CloudEvent is received, Sveltos automatically creates a Kubernetes namespace in the originating cluster. A user logout CloudEvent triggers the deletion of that namespace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: lib.projectsveltos.io/v1beta1
kind: EventSource
metadata:
  name: user-operation
spec:
  messagingMatchCriteria:
  - subject: "user-operation"
    cloudEventSource: "auth.example.com"
---
apiVersion: lib.projectsveltos.io/v1beta1
kind: EventTrigger
metadata:
  name: manage-namespace
spec:
  sourceClusterSelector:
    matchLabels:
      env: production
  eventSourceName: user-operation
  oneForEvent: true
  syncMode: ContinuousWithDriftDetection
  cloudEventAction: '{{if eq .CloudEvent.type "auth.example.com.logout"}}Delete{{else}}Create{{end}}'
  policyRefs:
  - name: namespace
    namespace: default
    kind: ConfigMap
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: namespace
  namespace: default
  annotations:
    projectsveltos.io/instantiate: ok
data:
  namespace.yaml: |
    kind: Namespace
    apiVersion: v1
    metadata:
      name: {{ .CloudEvent.subject }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Submit a CloudEvent for user login
&lt;/h2&gt;

&lt;p&gt;Trigger the user login event by publishing the following CloudEvent to the &lt;em&gt;user-operation&lt;/em&gt; NATS subject:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLOUDEVENT_JSON=$(cat &amp;lt;&amp;lt; EOF                                                                                     
{
  "specversion": "1.0",
  "type": "auth.example.com.login",
  "source": "auth.example.com",
  "id": "10001",
  "subject": "mgianluc",
  "datacontenttype": "application/json",
  "data": {
    "message": "User mgianluc login"
  }
}
EOF
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KUBECONFIG=&amp;lt;production cluster kubeconfig&amp;gt; kubectl exec -it deployment/nats-box -n nats -- nats pub user-operation $CLOUDEVENT_JSON --user=admin --password=my-password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm the namespace &lt;em&gt;mgianluc&lt;/em&gt; has been created using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons                                                    
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
|           CLUSTER           | RESOURCE TYPE |   NAMESPACE    |     NAME     | VERSION |             TIME              |                     PROFILES                     |
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
| default/clusterapi-workload | helm chart    | nats           | nats         | 1.2.9   | 2025-02-04 14:06:14 +0100 CET | ClusterProfile/nats                              |
| default/clusterapi-workload | :Secret       | projectsveltos | sveltos-nats | N/A     | 2025-02-04 14:06:36 +0100 CET | ClusterProfile/deploy-deploy-sveltos-nats-secret |
| default/clusterapi-workload | :Namespace    |                | mgianluc     | N/A     | 2025-02-04 14:12:03 +0100 CET | ClusterProfile/sveltos-gbv99bcdsk1aa04jkdzv      |
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Submit a CloudEvent representing user logout
&lt;/h2&gt;

&lt;p&gt;Publish the user logout CloudEvent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLOUDEVENT_JSON=$(cat &amp;lt;&amp;lt; EOF                                                                                     
{
  "specversion": "1.0",
  "type": "auth.example.com.logout",
  "source": "auth.example.com",
  "id": "10001",
  "subject": "mgianluc",
  "datacontenttype": "application/json",
  "data": {
    "message": "User mgianluc logout"
  }
}
EOF
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KUBECONFIG=&amp;lt;production cluster kubeconfig&amp;gt; kubectl exec -it deployment/nats-box -n nats -- nats pub user-operation $CLOUDEVENT_JSON --user=admin --password=my-password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify namespace deletion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons                                                                                                                        
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
|           CLUSTER           | RESOURCE TYPE |   NAMESPACE    |     NAME     | VERSION |             TIME              |                     PROFILES                     |
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
| default/clusterapi-workload | helm chart    | nats           | nats         | 1.2.9   | 2025-02-04 14:06:14 +0100 CET | ClusterProfile/nats                              |
| default/clusterapi-workload | :Secret       | projectsveltos | sveltos-nats | N/A     | 2025-02-04 14:06:36 +0100 CET | ClusterProfile/deploy-deploy-sveltos-nats-secret |
+-----------------------------+---------------+----------------+--------------+---------+-------------------------------+--------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article demonstrates how Sveltos can use NATS to react to external events and automate Kubernetes resource provisioning (in this case, namespaces) across a fleet of managed clusters. This provides a powerful, event-driven approach to multi-cluster Kubernetes management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;br&gt;
Thank you for reading!&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>devops</category>
      <category>eventdriven</category>
    </item>
    <item>
      <title>Automate vCluster Management in EKS with Sveltos and Helm</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Wed, 15 Jan 2025 11:13:36 +0000</pubDate>
      <link>https://dev.to/gianlucam76/automate-vcluster-management-in-eks-with-sveltos-and-helm-4on2</link>
      <guid>https://dev.to/gianlucam76/automate-vcluster-management-in-eks-with-sveltos-and-helm-4on2</guid>
      <description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=GQM7Qn9rWVU" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuomeu5zovqxprzywp0g7.jpg" alt="Sveltos introduction" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;This video demonstrates how to fully automate the deployment and management of remote vClusters running in EKS using the Sveltos event framework and Helm.&lt;/p&gt;

&lt;p&gt;In this video, each developer gets an isolated Kubernetes environment that can be managed independently. The process involves using a load balancer service as an event source, which triggers the creation of vClusters for each developer automatically.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Create Event-Driven Resources in Kubernetes</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Thu, 26 Dec 2024 15:42:42 +0000</pubDate>
      <link>https://dev.to/gianlucam76/how-to-create-event-driven-resources-in-kubernetes-5dl</link>
      <guid>https://dev.to/gianlucam76/how-to-create-event-driven-resources-in-kubernetes-5dl</guid>
      <description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=4mOWuOF0gWY" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1aw99n2jeinyd712o6l.jpg" alt="Sveltos introduction" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;In this video, Colin introduces the Sveltos Events Framework, which allows cluster admins to create event listeners and handlers for K8s resource creation. When one resource is created, you can automatically respond by creating another resources or helm charts!&lt;/p&gt;

&lt;p&gt;If you haven't checked first video, here is the &lt;a href="https://www.youtube.com/watch?v=%204mOWuOF0gWY" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to know more about ProjectSveltos check out the &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>kubernetes</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
    <item>
      <title>Kubernetes Fleet Resource Orchestration</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Wed, 18 Dec 2024 12:58:04 +0000</pubDate>
      <link>https://dev.to/gianlucam76/what-is-project-sveltos-1f84</link>
      <guid>https://dev.to/gianlucam76/what-is-project-sveltos-1f84</guid>
      <description>&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=bsWEo79w09c" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe7zbmhiadq36cfgag422.jpg" alt="Sveltos introduction" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;In this video Colin Lacy covers the core features of cluster configuration and add-on management. &lt;/p&gt;

&lt;p&gt;If you want to know more about ProjectSveltos check out the &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
    <item>
      <title>Simplifying Secret Distribution Across Kubernetes Clusters</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Mon, 25 Nov 2024 07:37:59 +0000</pubDate>
      <link>https://dev.to/gianlucam76/simplifying-secret-distribution-across-kubernetes-clusters-3o26</link>
      <guid>https://dev.to/gianlucam76/simplifying-secret-distribution-across-kubernetes-clusters-3o26</guid>
      <description>&lt;p&gt;A secret, in the context of software, is any piece of sensitive information that you want to keep confidential. This could include API keys, passwords, certificates, or SSH keys.&lt;/p&gt;

&lt;p&gt;Now, imagine managing a fleet of Kubernetes clusters, each requiring access to the same secret. The traditional approach often involves manually creating and distributing the secret to each cluster, a time-consuming and error-prone process.&lt;/p&gt;

&lt;p&gt;To streamline this process and enhance security, you need a solution that allows you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Centralize Secret Storage&lt;/strong&gt;: Store the secret in a single, secure location.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automate Secret Distribution&lt;/strong&gt;: Automatically deploy the secret to all target clusters.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the following sections, we’ll explore how Sveltos can help you achieve these goals.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Sveltos
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;In a management cluster, each individual Kubernetes cluster is represented by a dedicated resource. Labels can be attached to those resources.&lt;/p&gt;

&lt;p&gt;Sveltos configuration utilises a concept called a cluster selector. This selector essentially acts like a filter based on Kubernetes labels. By defining specific labels or combinations of labels, you can create a subset of clusters that share those characteristics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6404ubl4f5v0bzaxvne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6404ubl4f5v0bzaxvne.png" alt="Sveltos add-on deployment" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Setup
&lt;/h2&gt;

&lt;p&gt;A Kind cluster is used as management cluster. Then two extra Civo clusters and a GKE cluster all with label &lt;em&gt;env=prod&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------------------+-------------+-------------------------------------+
|    Cluster Name        |   Version   |             Comments                |
+------------------------+-------------+-------------------------------------+
|    civo/cluster1       | v1.29.8+k3s1| Civo 3 Node - Medium Standard       |
|    civo/cluster2       | v1.30.5+k3s1| Civo 3 Node - Medium Standard       |
+------------------------+-------------+-------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1: Install Sveltos on Managament Cluster
&lt;/h2&gt;

&lt;p&gt;For this tutorial, we will install Sveltos in the management cluster. Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.42.0/manifest/manifest.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.42.0/manifest/default-classifier.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Register Clusters with Sveltos
&lt;/h2&gt;

&lt;p&gt;Using Civo UI, download the Kubeconfigs, then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create ns civo
sveltosctl register cluster --namespace=civo --cluster=cluster1 --kubeconfig=civo-cluster1-kubeconfig --labels=env=production
sveltosctl register cluster --namespace=civo --cluster=cluster2 --kubeconfig=civo-cluster2-kubeconfig --labels=env=production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your Civo clusters were successfully registered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get sveltoscluster -A --show-labels
NAMESPACE   NAME       READY   VERSION        LABELS
civo        cluster1   true    v1.29.8+k3s1   env=production,projectsveltos.io/k8s-version=v1.29.8,sveltos-agent=present
civo        cluster2   true    v1.30.5+k3s1   env=production,projectsveltos.io/k8s-version=v1.30.5,sveltos-agent=present
mgmt        mgmt       true    v1.31.2        projectsveltos.io/k8s-version=v1.31.2,sveltos-agent=present
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Deploy Sveltos configuration
&lt;/h2&gt;

&lt;p&gt;First create a Secret of type &lt;em&gt;kubernetes.io/dockerconfigjson&lt;/em&gt; to authenticate with a container registry to pull a private image. This will create a Secret &lt;em&gt;regcred&lt;/em&gt; in the &lt;em&gt;default&lt;/em&gt; namespace on the management cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/refs/heads/main/propagate-secret/secret.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now configure Sveltos to automatically copy the regcred Secret to namespaces that require it. This configuration will instruct Sveltos to watch for any new namespaces in your production clusters that have the label &lt;em&gt;imagepullsecret: required&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;When Sveltos detects a new namespace with this label, it will automatically copy the &lt;em&gt;regcred&lt;/em&gt; Secret from the management cluster to the newly created namespace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/refs/heads/main/propagate-secret/config.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6td0sv6kk0sjk4g6am47.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6td0sv6kk0sjk4g6am47.gif" alt="Sveltos Secret Distributions" width="427" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Create namespaces within Civo clusters
&lt;/h2&gt;

&lt;p&gt;Create the &lt;em&gt;coke&lt;/em&gt; namespace in Civo cluster 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KUBECONFIG=&amp;lt;CIVO cluster1 kubeconfig&amp;gt; kubectl create namespace coke
KUBECONFIG=&amp;lt;CIVO cluster1 kubeconfig&amp;gt; kubectl label namespace coke imagepullsecret=required
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To confirm that the &lt;em&gt;regcred&lt;/em&gt; secret has been successfully propagated to the &lt;em&gt;coke&lt;/em&gt; namespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons  
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
|    CLUSTER    | RESOURCE TYPE | NAMESPACE |  NAME   | VERSION |             TIME              |                  PROFILES                   |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
| civo/cluster1 | :Secret       | coke      | regcred | N/A     | 2024-11-20 14:43:05 +0100 CET | ClusterProfile/sveltos-t4q7bhsrkhul3fkh6v0k |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can follow the same steps to create additional namespaces in Civo cluster 1 (e.g., &lt;em&gt;pepsi&lt;/em&gt;) and Civo cluster 2 (e.g., &lt;em&gt;bar&lt;/em&gt;), ensuring they inherit the necessary image pull secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KUBECONFIG=&amp;lt;CIVO cluster1 kubeconfig&amp;gt; kubectl create namespace pepsi
KUBECONFIG=&amp;lt;CIVO cluster1 kubeconfig&amp;gt; kubectl label namespace pepsiimagepullsecret=required

KUBECONFIG=&amp;lt;CIVO cluster2 kubeconfig&amp;gt; kubectl create namespace bar
KUBECONFIG=&amp;lt;CIVO cluster2 kubeconfig&amp;gt; kubectl label namespace bar imagepullsecret=required
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify Sveltos has propagated the Secret to all namespaces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons                                                                           
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
|    CLUSTER    | RESOURCE TYPE | NAMESPACE |  NAME   | VERSION |             TIME              |                  PROFILES                   |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
| civo/cluster1 | :Secret       | coke      | regcred | N/A     | 2024-11-20 14:44:41 +0100 CET | ClusterProfile/sveltos-t4q7bhsrkhul3fkh6v0k |
| civo/cluster1 | :Secret       | pepsi     | regcred | N/A     | 2024-11-20 14:44:42 +0100 CET | ClusterProfile/sveltos-t4q7bhsrkhul3fkh6v0k |
| civo/cluster2 | :Secret       | bar       | regcred | N/A     | 2024-11-20 14:45:03 +0100 CET | ClusterProfile/sveltos-3ef2he7v7fklm1s03coa |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Update Secret
&lt;/h2&gt;

&lt;p&gt;While pointing to the management cluster, update the &lt;em&gt;regcred&lt;/em&gt; Secret:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/refs/heads/main/propagate-secret/update-secret.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify Secret has been updated to all production clusters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons                                                                                   
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
|    CLUSTER    | RESOURCE TYPE | NAMESPACE |  NAME   | VERSION |             TIME              |                  PROFILES                   |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
| civo/cluster1 | :Secret       | coke      | regcred | N/A     | 2024-11-20 14:54:14 +0100 CET | ClusterProfile/sveltos-t4q7bhsrkhul3fkh6v0k |
| civo/cluster1 | :Secret       | pepsi     | regcred | N/A     | 2024-11-20 14:54:15 +0100 CET | ClusterProfile/sveltos-t4q7bhsrkhul3fkh6v0k |
| civo/cluster2 | :Secret       | bar       | regcred | N/A     | 2024-11-20 14:54:15 +0100 CET | ClusterProfile/sveltos-3ef2he7v7fklm1s03coa |
+---------------+---------------+-----------+---------+---------+-------------------------------+---------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: External Secrets Operator
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://external-secrets.io/" rel="noopener noreferrer"&gt;External Secrets Operator&lt;/a&gt; is an open source Kubernetes operator that integrates external secret management systems like AWS Secrets Manager, HashiCorp Vault, Google Secrets Manager, Azure Key Vault, IBM Cloud Secrets Manager, and many more. The goal of External Secrets Operator is to synchronize secrets from external APIs into Kubernetes. The operator reads information from external APIs and automatically injects the values into a Kubernetes Secret. If the secret from the external API changes, the controller will reconcile the state in the cluster and update the secrets accordingly.&lt;/p&gt;

&lt;p&gt;When managing a multitude of Kubernetes clusters, External Secrets Operator can be deployed in the management cluster. Sveltos can be used to distribute the secrets to the managed clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp27wvafe9yan3cj1e617.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp27wvafe9yan3cj1e617.gif" alt="Sveltos External Secrets Operator Integration" width="427" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This guide demonstrated how Sveltos simplifies the process of propagating secrets to all your production clusters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;br&gt;
The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;br&gt;
Thank you for reading!&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>showdev</category>
      <category>opensource</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>CIS Benchmark Compliance Across Multiple Kubernetes Clusters</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Thu, 26 Sep 2024 11:48:17 +0000</pubDate>
      <link>https://dev.to/gianlucam76/cis-benchmark-compliance-across-multiple-kubernetes-clusters-2nm5</link>
      <guid>https://dev.to/gianlucam76/cis-benchmark-compliance-across-multiple-kubernetes-clusters-2nm5</guid>
      <description>&lt;p&gt;&lt;a href="https://www.cisecurity.org/benchmark/kubernetes" rel="noopener noreferrer"&gt;CIS Kubernetes Benchmarks&lt;/a&gt; are a set of security best practices and recommendations developed by the Center for Internet Security (CIS) specifically for Kubernetes environments. These benchmarks provide a comprehensive guide to secure configuration, helping organizations reduce the risk of common vulnerabilities and attacks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/aquasecurity/kube-bench" rel="noopener noreferrer"&gt;kube-bench&lt;/a&gt; is a tool that checks whether Kubernetes is deployed securely by running the checks documented in the CIS Kubernetes Benchmark. Tests are configured with YAML files, making this tool easy to update as test specifications evolve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbls16sgcorgyjr1klkmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbls16sgcorgyjr1klkmy.png" alt="kube-bench result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6woy2hyc6czjrhy2wb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6woy2hyc6czjrhy2wb5.png" alt="Sveltos: add-on deployment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article demonstrates how Sveltos can deploy Kube-bench in each managed cluster, and finally leverage event mechanisms to post-process and collect kube-bench from each managed cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Setup
&lt;/h2&gt;

&lt;p&gt;A Kind cluster is used as management cluster. Then two extra Civo clusters and a GKE cluster all with label &lt;em&gt;env=production&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+------------------------+-------------+-------------------------------------+
|    Cluster Name        |   Version   |             Comments                |
+------------------------+-------------+-------------------------------------+
|    civo/cluster1       | v1.28.7+k3s1| Civo 3 Node - Medium Standard       |
|    civo/cluster2       | v1.29.2+k3s1| Civo 3 Node - Medium Standard       |
|    gke/cluster         | v1.30.3-gke | GKE 3 Node                          |
+------------------------+-------------+-------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 1: Install Sveltos on Managament Cluster
&lt;/h2&gt;

&lt;p&gt;For this tutorial, we will install Sveltos in the management cluster. Sveltos installation details can be found here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.38.3/manifest/manifest.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.38.3/manifest/default-classifier.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Register Clusters with Sveltos
&lt;/h2&gt;

&lt;p&gt;Using Civo UI, download the Kubeconfigs, then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create ns civo
sveltosctl register cluster --namespace=civo --cluster=cluster1 --kubeconfig=civo-cluster1-kubeconfig --labels=env=production
sveltosctl register cluster --namespace=civo --cluster=cluster2 --kubeconfig=civo-cluster2-kubeconfig --labels=env=production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;a href="https://github.com/projectsveltos/sveltosctl" rel="noopener noreferrer"&gt;sveltosctl&lt;/a&gt;, pointing to the GKE cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl generate kubeconfig --create --expirationSeconds=86400 &amp;gt; gke_kubeconfig
sveltosctl register cluster --namespace=gke --cluster=cluster --kubeconfig=gke_kubeconfig --labels=env=production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your Civo and GKE clusters were successfully registered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get sveltoscluster -A --show-labels                                                               
NAMESPACE   NAME       READY   VERSION               LABELS
civo        cluster1   true    v1.28.7+k3s1          env=production,projectsveltos.io/k8s-version=v1.28.7,sveltos-agent=present
civo        cluster2   true    v1.29.2+k3s1          env=production,projectsveltos.io/k8s-version=v1.29.2,sveltos-agent=present
gke         cluster    true    v1.30.3-gke.1969001   env=production,projectsveltos.io/k8s-version=v1.30.3,sveltos-agent=present
mgmt        mgmt       true    v1.31.0               projectsveltos.io/k8s-version=v1.31.0,sveltos-agent=present
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Deploy kube-bench
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kynu4bddzv29zznhlea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4kynu4bddzv29zznhlea.png" alt="Sveltos: deploy kube-bench to all production clusters"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sveltos&lt;/strong&gt; is used to deploy &lt;strong&gt;kube-bench&lt;/strong&gt; in all production clusters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/cis-scan/kube-bench.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/cis-scan/clusterprofile-deploy-kube-bench.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above creates a ConfigMap in the management cluster containing kube-bench in its data section. And a ClusterProfile resource that targets all production clusters. The ClusterProfile deploys kube-bench.&lt;/p&gt;

&lt;p&gt;Verify all resources are deployed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show addons
+---------------+---------------+------------+------------+---------+--------------------------------+----------------------------------+
|    CLUSTER    | RESOURCE TYPE | NAMESPACE  |    NAME    | VERSION |              TIME              |             PROFILES             |
+---------------+---------------+------------+------------+---------+--------------------------------+----------------------------------+
| civo/cluster1 | batch:Job     | kube-bench | kube-bench | N/A     | 2024-09-24 14:33:27 +0200 CEST | ClusterProfile/deploy-kube-bench |
| civo/cluster2 | batch:Job     | kube-bench | kube-bench | N/A     | 2024-09-24 14:33:49 +0200 CEST | ClusterProfile/deploy-kube-bench |
| gke/cluster   | batch:Job     | kube-bench | kube-bench | N/A     | 2024-09-24 14:33:37 +0200 CEST | ClusterProfile/deploy-kube-bench |
+---------------+---------------+------------+------------+---------+--------------------------------+-----------
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Use Event Frameworks to Collect Kube-bench Results
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/cis-scan/clusterprofile-deploy-kube-bench.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/cis-scan/events.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kube-bench results are initially stored in the kube-bench logs. To facilitate analysis and reporting, this process deploys a Job in each managed cluster. This Job post-processes the kube-bench logs, extracting and storing all failure information in a ConfigMap. These ConfigMaps are then automatically collected by Sveltos and sent to the management cluster for centralized review and action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn00emjmeilb8fxflyqyc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn00emjmeilb8fxflyqyc.png" alt="Sveltos: post-process and collect kube-bench results"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Use sveltosctl to display all failures
&lt;/h2&gt;

&lt;p&gt;sveltosctl provides a comprehensive overview of issues identified by kube-bench across our managed production clusters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sveltosctl show resources --kind=configmap 
+---------------+---------------------+------------+---------------------+--------------------------------+
|    CLUSTER    |         GVK         | NAMESPACE  |        NAME         |            MESSAGE             |
+---------------+---------------------+------------+---------------------+--------------------------------+
| civo/cluster1 | /v1, Kind=ConfigMap | kube-bench | kube-bench-failures | [FAIL] 4.1.1 Ensure that       |
|               |                     |            |                     | the kubelet service file       |
|               |                     |            |                     | permissions are set to 600 or  |
|               |                     |            |                     | more restrictive (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.5 Ensure that the   |
|               |                     |            |                     | --kubeconfig kubelet.conf      |
|               |                     |            |                     | file permissions are set       |
|               |                     |            |                     | to 600 or more restrictive     |
|               |                     |            |                     | (Automated) [FAIL] 4.1.6       |
|               |                     |            |                     | Ensure that the --kubeconfig   |
|               |                     |            |                     | kubelet.conf file ownership is |
|               |                     |            |                     | set to root:root (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.9 If the kubelet    |
|               |                     |            |                     | config.yaml configuration      |
|               |                     |            |                     | file is being used validate    |
|               |                     |            |                     | permissions set to 600 or      |
|               |                     |            |                     | more restrictive (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.10 If the kubelet   |
|               |                     |            |                     | config.yaml configuration      |
|               |                     |            |                     | file is being used validate    |
|               |                     |            |                     | file ownership is set          |
|               |                     |            |                     | to root:root (Automated)       |
|               |                     |            |                     | [FAIL] 4.2.1 Ensure that the   |
|               |                     |            |                     | --anonymous-auth argument      |
|               |                     |            |                     | is set to false (Automated)    |
|               |                     |            |                     | [FAIL] 4.2.2 Ensure that       |
|               |                     |            |                     | the --authorization-mode       |
|               |                     |            |                     | argument is not set to         |
|               |                     |            |                     | AlwaysAllow (Automated)        |
|               |                     |            |                     | [FAIL] 4.2.3 Ensure that the   |
|               |                     |            |                     | --client-ca-file argument is   |
|               |                     |            |                     | set as appropriate (Automated) |
|               |                     |            |                     | [FAIL] 4.2.6 Ensure that the   |
|               |                     |            |                     | --make-iptables-util-chains    |
|               |                     |            |                     | argument is set to             |
|               |                     |            |                     | true (Automated) [FAIL]        |
|               |                     |            |                     | 4.2.10 Ensure that the         |
|               |                     |            |                     | --rotate-certificates          |
|               |                     |            |                     | argument is not set to false   |
|               |                     |            |                     | (Automated) [FAIL] 4.3.1       |
|               |                     |            |                     | Ensure that the kube-proxy     |
|               |                     |            |                     | metrics service is bound       |
|               |                     |            |                     | to localhost (Automated)       |
|               |                     |            |                     | [FAIL] 5.1.1 Ensure that       |
|               |                     |            |                     | the cluster-admin role is      |
|               |                     |            |                     | only used where required       |
|               |                     |            |                     | (Automated) [FAIL] 5.1.2       |
|               |                     |            |                     | Minimize access to secrets     |
|               |                     |            |                     | (Automated) [FAIL] 5.1.3       |
|               |                     |            |                     | Minimize wildcard use in Roles |
|               |                     |            |                     | and ClusterRoles (Automated)   |
|               |                     |            |                     | [FAIL] 5.1.4 Minimize access   |
|               |                     |            |                     | to create pods (Automated)     |
|               |                     |            |                     | [FAIL] 5.1.5 Ensure that       |
|               |                     |            |                     | default service accounts are   |
|               |                     |            |                     | not actively used. (Automated) |
|               |                     |            |                     | [FAIL] 5.1.6 Ensure that       |
|               |                     |            |                     | Service Account Tokens are     |
|               |                     |            |                     | only mounted where necessary   |
|               |                     |            |                     | (Automated)                    |
| civo/cluster2 |                     | kube-bench | kube-bench-failures | [FAIL] 4.1.1 Ensure that       |
|               |                     |            |                     | the kubelet service file       |
|               |                     |            |                     | permissions are set to 600 or  |
|               |                     |            |                     | more restrictive (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.5 Ensure that the   |
|               |                     |            |                     | --kubeconfig kubelet.conf      |
|               |                     |            |                     | file permissions are set       |
|               |                     |            |                     | to 600 or more restrictive     |
|               |                     |            |                     | (Automated) [FAIL] 4.1.6       |
|               |                     |            |                     | Ensure that the --kubeconfig   |
|               |                     |            |                     | kubelet.conf file ownership is |
|               |                     |            |                     | set to root:root (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.9 If the kubelet    |
|               |                     |            |                     | config.yaml configuration      |
|               |                     |            |                     | file is being used validate    |
|               |                     |            |                     | permissions set to 600 or      |
|               |                     |            |                     | more restrictive (Automated)   |
|               |                     |            |                     | [FAIL] 4.1.10 If the kubelet   |
|               |                     |            |                     | config.yaml configuration      |
|               |                     |            |                     | file is being used validate    |
|               |                     |            |                     | file ownership is set          |
|               |                     |            |                     | to root:root (Automated)       |
|               |                     |            |                     | [FAIL] 4.2.1 Ensure that the   |
|               |                     |            |                     | --anonymous-auth argument      |
|               |                     |            |                     | is set to false (Automated)    |
|               |                     |            |                     | [FAIL] 4.2.2 Ensure that       |
|               |                     |            |                     | the --authorization-mode       |
|               |                     |            |                     | argument is not set to         |
|               |                     |            |                     | AlwaysAllow (Automated)        |
|               |                     |            |                     | [FAIL] 4.2.3 Ensure that the   |
|               |                     |            |                     | --client-ca-file argument is   |
|               |                     |            |                     | set as appropriate (Automated) |
|               |                     |            |                     | [FAIL] 4.2.6 Ensure that the   |
|               |                     |            |                     | --make-iptables-util-chains    |
|               |                     |            |                     | argument is set to             |
|               |                     |            |                     | true (Automated) [FAIL]        |
|               |                     |            |                     | 4.2.10 Ensure that the         |
|               |                     |            |                     | --rotate-certificates          |
|               |                     |            |                     | argument is not set to false   |
|               |                     |            |                     | (Automated) [FAIL] 4.3.1       |
|               |                     |            |                     | Ensure that the kube-proxy     |
|               |                     |            |                     | metrics service is bound       |
|               |                     |            |                     | to localhost (Automated)       |
|               |                     |            |                     | [FAIL] 5.1.1 Ensure that       |
|               |                     |            |                     | the cluster-admin role is      |
|               |                     |            |                     | only used where required       |
|               |                     |            |                     | (Automated) [FAIL] 5.1.2       |
|               |                     |            |                     | Minimize access to secrets     |
|               |                     |            |                     | (Automated) [FAIL] 5.1.3       |
|               |                     |            |                     | Minimize wildcard use in Roles |
|               |                     |            |                     | and ClusterRoles (Automated)   |
|               |                     |            |                     | [FAIL] 5.1.4 Minimize access   |
|               |                     |            |                     | to create pods (Automated)     |
|               |                     |            |                     | [FAIL] 5.1.5 Ensure that       |
|               |                     |            |                     | default service accounts are   |
|               |                     |            |                     | not actively used. (Automated) |
|               |                     |            |                     | [FAIL] 5.1.6 Ensure that       |
|               |                     |            |                     | Service Account Tokens are     |
|               |                     |            |                     | only mounted where necessary   |
|               |                     |            |                     | (Automated)                    |
| gke/cluster   |                     | kube-bench | kube-bench-failures | [FAIL] 3.2.1 Ensure that the   |
|               |                     |            |                     | --anonymous-auth argument      |
|               |                     |            |                     | is set to false (Automated)    |
|               |                     |            |                     | [FAIL] 3.2.2 Ensure that       |
|               |                     |            |                     | the --authorization-mode       |
|               |                     |            |                     | argument is not set to         |
|               |                     |            |                     | AlwaysAllow (Automated)        |
|               |                     |            |                     | [FAIL] 3.2.3 Ensure that the   |
|               |                     |            |                     | --client-ca-file argument is   |
|               |                     |            |                     | set as appropriate (Automated) |
|               |                     |            |                     | [FAIL] 3.2.6 Ensure that the   |
|               |                     |            |                     | --protect-kernel-defaults      |
|               |                     |            |                     | argument is set to true        |
|               |                     |            |                     | (Manual) [FAIL] 3.2.9 Ensure   |
|               |                     |            |                     | that the --event-qps argument  |
|               |                     |            |                     | is set to 0 or a level which   |
|               |                     |            |                     | ensures appropriate event      |
|               |                     |            |                     | capture (Automated) [FAIL]     |
|               |                     |            |                     | 3.2.12 Ensure that the         |
|               |                     |            |                     | RotateKubeletServerCertificate |
|               |                     |            |                     | argument is set to true        |
|               |                     |            |                     | (Automated)                    |
+---------------+---------------------+------------+---------------------+--------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article has demonstrated how Sveltos can be leveraged to achieve centralized and automated security auditing of Kubernetes clusters using CIS Benchmarks and kube-bench.&lt;br&gt;
By utilizing Sveltos and kube-bench together, organizations can gain a comprehensive overview of the security posture of their Kubernetes clusters and take necessary steps to address any identified vulnerabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contact Information
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at medium, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;/p&gt;

&lt;p&gt;You can also &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;star 🌟 the project&lt;/a&gt; if you found it helpful.&lt;/p&gt;

&lt;p&gt;Thank you for reading!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>kubernetes</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
    <item>
      <title>Gateway API: Exposing managed services with Kong and Sveltos</title>
      <dc:creator>Gianluca</dc:creator>
      <pubDate>Thu, 08 Aug 2024 13:20:28 +0000</pubDate>
      <link>https://dev.to/gianlucam76/gateway-api-exposing-managed-services-with-kong-and-sveltos-592f</link>
      <guid>https://dev.to/gianlucam76/gateway-api-exposing-managed-services-with-kong-and-sveltos-592f</guid>
      <description>&lt;p&gt;Kubernetes Services act as a stable access point for our microservices, abstracting away the complexity of managing multiple instances or their locations. Building on this, the &lt;a href="https://gateway-api.sigs.k8s.io/" rel="noopener noreferrer"&gt;Gateway API&lt;/a&gt; serves as a unified entry point for multiple Kubernetes Services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk83g0xo0uvaj3jzapl7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk83g0xo0uvaj3jzapl7.png" alt="Gateway API: Exposing Services"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Sveltos&lt;/a&gt; is a set of Kubernetes controllers that run in the management cluster. From the management cluster, Sveltos can manage add-ons and applications on a fleet of managed Kubernetes clusters. It is a declarative tool to ensure that the desired state of an application is always reflected in the actual state of the Kubernetes managed clusters.&lt;/p&gt;

&lt;p&gt;This article demonstrates how &lt;strong&gt;Sveltos&lt;/strong&gt; can deploy &lt;strong&gt;Kong&lt;/strong&gt; as an API Gateway in the management cluster, subsequently deploy &lt;strong&gt;nginx&lt;/strong&gt; services to managed clusters, and finally leverage templating and event mechanisms to expose these services through the API Gateway in the management cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ywvm7got6cskob5fw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8ywvm7got6cskob5fw1.png" alt="Sveltos and Gateway API: Exposing Services from multiple clusters"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Setup
&lt;/h2&gt;

&lt;p&gt;A Civo cluster is used as management cluster. Then two extra Civo clusters, all with label &lt;em&gt;env=fv&lt;/em&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

+------------------------+-------------+-------------------------------------+
|    Cluster Name        |   Version   |             Comments                |
+------------------------+-------------+-------------------------------------+
|    cluster1            | v1.29.2+k3s1| Civo 3 Node - Medium Standard       |
|    cluster2            | v1.28.7+k3s1| Civo 3 Node - Medium Standard       |
+------------------------+-------------+-------------------------------------+


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For this demo, Sveltos needs extra permissions.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl edit clusterroles addon-controller-role-extra


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and add following permissions&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

- apiGroups:
  - ""
  resources:
  - services
  - endpoints
  verbs:
  - "*"
- apiGroups:
  - "gateway.networking.k8s.io"
  resources:
  - httproutes
  verbs:
  - "*"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 1: Install Sveltos on Managament Cluster
&lt;/h2&gt;

&lt;p&gt;For this demonstration, we will install Sveltos in the management cluster. Sveltos installation details can be found &lt;a href="https://projectsveltos.github.io/sveltos/getting_started/install/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.35.0/manifest/manifest.yaml
kubectl apply -f https://raw.githubusercontent.com/projectsveltos/sveltos/v0.35.0/manifest/default-classifier.yaml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 2: Register Civo Cluster with Sveltos
&lt;/h2&gt;

&lt;p&gt;Create two Kubernetes clusters using Civo UI. Download the Kubeconfigs, then using &lt;a href="https://github.com/projectsveltos/sveltosctl/releases" rel="noopener noreferrer"&gt;sveltosctl&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl create ns civo
sveltosctl register cluster --namespace=civo --cluster=cluster1 --kubeconfig=civo-cluster1-kubeconfig --labels=env=fv
sveltosctl register cluster --namespace=civo --cluster=cluster2 --kubeconfig=civo-cluster2-kubeconfig --labels=env=fv


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Verify your Civo were successfully registered:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl get sveltoscluster -n civo
NAME       READY   VERSION
cluster1   true    v1.28.7+k3s1
cluster2   true    v1.29.2+k3s1


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 3: Deploy Kong as API Gateway
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sveltos&lt;/strong&gt; is used to deploy &lt;strong&gt;Kong&lt;/strong&gt; as an API Gateway in the management cluster.&lt;/p&gt;

&lt;p&gt;First, we label the management cluster with &lt;em&gt;type: mgmt&lt;/em&gt;.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl label sveltoscluster -n mgmt mgmt type=mgmt


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next, we’ll deploy the necessary Gateway API resources. This includes the core Custom Resource Definitions (CRDs), a GatewayClass to specify the API gateway implementation (Kong in this case), and a Gateway instance to represent the actual API gateway.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

wget https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/standard-install.yaml 
kubectl create configmap apigateway-crds --from-file=standard-install.yaml

wget https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/gateway.yaml 
kubectl create configmap gateway --from-file=gateway.yaml

kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/clusterprofile-apigateway.yaml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Finally we will deploy Kong Helm chart with Sveltos:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/clusterprofile-kong.yaml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ClusterProfile configuration involves selecting the management cluster using clusterSelector and deploying the Kong Helm chart&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;

&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;apigateway&lt;/span&gt; 
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mgmt&lt;/span&gt;
  &lt;span class="na"&gt;helmCharts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repositoryURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;https://charts.konghq.com&lt;/span&gt;
    &lt;span class="na"&gt;repositoryName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;chartName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;        &lt;span class="s"&gt;kong/ingress&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;     &lt;span class="s"&gt;0.13.1&lt;/span&gt;
    &lt;span class="na"&gt;releaseName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;releaseNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;helmChartAction&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  &lt;span class="s"&gt;Install&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Verify all resources are deployed:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

+-----------+-----------------------------------------------+-----------+-------------------------------------------+---------+--------------------------------+---------------------------+
|  CLUSTER  |                 RESOURCE TYPE                 | NAMESPACE |                   NAME                    | VERSION |              TIME              |         PROFILES          |
+-----------+-----------------------------------------------+-----------+-------------------------------------------+---------+--------------------------------+---------------------------+
| mgmt/mgmt | helm chart                                    | kong      | kong                                      | 0.13.1  | 2024-08-08 10:15:33 +0200 CEST | ClusterProfile/kong       |
| mgmt/mgmt | apiextensions.k8s.io:CustomResourceDefinition |           | gatewayclasses.gateway.networking.k8s.io  | N/A     | 2024-08-08 10:15:08 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | apiextensions.k8s.io:CustomResourceDefinition |           | gateways.gateway.networking.k8s.io        | N/A     | 2024-08-08 10:15:08 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | apiextensions.k8s.io:CustomResourceDefinition |           | grpcroutes.gateway.networking.k8s.io      | N/A     | 2024-08-08 10:15:08 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | apiextensions.k8s.io:CustomResourceDefinition |           | httproutes.gateway.networking.k8s.io      | N/A     | 2024-08-08 10:15:09 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | apiextensions.k8s.io:CustomResourceDefinition |           | referencegrants.gateway.networking.k8s.io | N/A     | 2024-08-08 10:15:09 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | gateway.networking.k8s.io:GatewayClass        |           | kong-class                                | N/A     | 2024-08-08 10:15:10 +0200 CEST | ClusterProfile/apigateway |
| mgmt/mgmt | gateway.networking.k8s.io:Gateway             | kong      | kong-gateway                              | N/A     | 2024-08-08 10:15:10 +0200 CEST | ClusterProfile/apigateway |
+-----------+-----------------------------------------------+-----------+-------------------------------------------+---------+--------------------------------+---------------------------+


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 4: Provision Nginx on Each Managed Cluster
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4azfahzwkdsp2mmec8lm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4azfahzwkdsp2mmec8lm.png" alt="Sveltos: Deploy Nginx in any managed cluster with label env: fv"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sveltos&lt;/strong&gt; deploys &lt;strong&gt;Nginx&lt;/strong&gt; to each managed cluster, exposing it via a LoadBalancer Service accessible only from the management cluster.&lt;/p&gt;

&lt;p&gt;Following creates a ConfigMap with nginx resources:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

wget https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/production-nginx.yaml
kubectl create configmap production-nginx --from-file=production-nginx.yaml
kubectl annotate configmap production-nginx projectsveltos.io/template=ok


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then use a ClusterProfile to deploy those resources to all managed clusters:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/clusterprofile-production-nginx.yaml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ClusterProfile selects managed clusters labeled env: fv and deploys resources defined in a referenced ConfigMap. This ConfigMap contains template-based Deployment and Service definitions, which are instantiated using information from the kong-gateway-proxy Service within the kong namespace of the management cluster.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;

&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config.projectsveltos.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterProfile&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production-nginx&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;clusterSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;fv&lt;/span&gt;
  &lt;span class="na"&gt;templateResourceRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Service&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong-gateway-proxy&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;identifier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;KongGatewayProxy&lt;/span&gt;
  &lt;span class="na"&gt;policyRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production-nginx&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ConfigMap&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Verify that nginx is successfully deployed on managed clusters:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

sveltosctl show addons --namespace=civo
+---------------+-----------------+-----------+------------------+---------+--------------------------------+---------------------------------+
|    CLUSTER    |  RESOURCE TYPE  | NAMESPACE |       NAME       | VERSION |              TIME              |            PROFILES             |
+---------------+-----------------+-----------+------------------+---------+--------------------------------+---------------------------------+
| civo/cluster2 | :ConfigMap      | default   | nginx-config     | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
| civo/cluster2 | apps:Deployment | default   | nginx-deployment | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
| civo/cluster2 | :Service        | default   | nginx-service    | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
| civo/cluster1 | :ConfigMap      | default   | nginx-config     | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
| civo/cluster1 | apps:Deployment | default   | nginx-deployment | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
| civo/cluster1 | :Service        | default   | nginx-service    | N/A     | 2024-08-08 10:17:56 +0200 CEST | ClusterProfile/production-nginx |
+---------------+-----------------+-----------+------------------+---------+--------------------------------+---------------------------------+


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 5: Configure HTTPRoute for each service
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49okorctdhnuszvk5497.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49okorctdhnuszvk5497.png" alt="Sveltos: exposes Services on managed clusters via Gateway API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sveltos&lt;/strong&gt; simplifies access to the Nginx services running in your managed clusters. It achieves this by leveraging the Gateway API:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Discovery&lt;/strong&gt;: Sveltos identifies the IP address and port of each LoadBalancer service sitting in front of Nginx instances within your managed clusters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Creation&lt;/strong&gt;: It creates a headless Service (without a cluster IP) in the management cluster. This Service represents the Nginx instance and references the discovered IP:port combination through an Endpoint resource.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTPRoute Generation&lt;/strong&gt;: Finally, Sveltos creates an HTTPRoute object for each Nginx instance. This HTTPRoute defines how traffic reaches the Nginx service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To achieve all of above just post:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl apply -f https://raw.githubusercontent.com/projectsveltos/demos/main/kong-apigateway/fetch-production-nginx.yaml


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Two HTTPRoutes instances were created by Sveltos on the management cluster:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl get httproutes -A                
NAMESPACE   NAME                     HOSTNAMES        AGE
civo        cluster2-nginx-service   ["worlds.com"]   22s
civo        cluster1-nginx-service   ["worlds.com"]   12s


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Looking at one of those HTTPRoute instances:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;

&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gateway.networking.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HTTPRoute&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cluster1-nginx-service&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;civo&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;hostnames&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;worlds.com&lt;/span&gt;
  &lt;span class="na"&gt;parentRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gateway.networking.k8s.io&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Gateway&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong-gateway&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;backendRefs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Service&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cluster1-nginx-service&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
      &lt;span class="na"&gt;weight&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;matches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PathPrefix&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/cluster1/nginx-service&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;it has a rule that redirects requests to the path &lt;em&gt;/cluster1/nginx-service&lt;/em&gt;. The rule points to a headless Service named &lt;em&gt;cluster1-nginx-service&lt;/em&gt; on port 80. This Service acts as a bridge to the actual Nginx instance behind the LoadBalancer in your managed cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55oyal7iffr6oglj8eh8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55oyal7iffr6oglj8eh8.gif" alt="Sveltos: exposes managed services via Gateway API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Reach the Nginx services via Gateway API
&lt;/h2&gt;

&lt;p&gt;Get the IP:port of the LoadBalancer service exposing the Gateway API&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl get services -n kong kong-gateway-proxy 
NAME                 TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)                      AGE
kong-gateway-proxy   LoadBalancer   10.43.126.228   212.2.242.138   80:32155/TCP,443:31584/TCP   19m


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;verify both Nginx services can be reached via Gateway API:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -H "Host: worlds.com" http://212.2.242.138:80/cluster1/nginx-service 
&amp;lt;html&amp;gt;
&amp;lt;h2&amp;gt;Hello world. We are in cluster1 cluster!&amp;lt;/h2&amp;gt;
&amp;lt;/html&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -H "Host: worlds.com" http://212.2.242.138:80/cluster2/nginx-service
&amp;lt;html&amp;gt;
&amp;lt;h2&amp;gt;Hello world. We are in cluster2 cluster!&amp;lt;/h2&amp;gt;
&amp;lt;/html&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Step 7: Add another managed cluster
&lt;/h2&gt;

&lt;p&gt;When you register a new cluster (e.g., cluster3), Sveltos takes care of everything for you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Automatic Nginx Deployment&lt;/strong&gt;: Sveltos automatically deploys an Nginx instance within the new cluster (cluster3).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway API Integration&lt;/strong&gt;: It creates an HTTPRoute object to manage traffic routing for the new Nginx instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seamless Service Access&lt;/strong&gt;: Clients can now access the Nginx service in cluster3 via Gateway API on the management cluster.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

sveltosctl register cluster --namespace=civo --cluster=cluster3 --kubeconfig=civo-cluster3-kubeconfig --labels=env=fv


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;New HTTPRoute is created by Sveltos:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

kubectl get httproutes -n civo                                                                                                                                   
NAME                     HOSTNAMES        AGE
cluster2-nginx-service   ["worlds.com"]   19m
cluster1-nginx-service   ["worlds.com"]   18m
cluster3-nginx-service   ["worlds.com"]   20s


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And reaching the Nginx instance on cluster3&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;curl -H "Host: worlds.com" &lt;a href="http://212.2.242.138:80/cluster3/nginx-service" rel="noopener noreferrer"&gt;http://212.2.242.138:80/cluster3/nginx-service&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&amp;lt;html&amp;gt;&lt;br&gt;
&amp;lt;h2&amp;gt;Hello world. We are in cluster3 cluster!&amp;lt;/h2&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Contact Information&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;If you have some questions, would like to have a friendly chat or just network to not miss any topics, then don’t use the comment function at dev.to, just feel free to add me to your &lt;a href="https://www.linkedin.com/in/gianlucamardente/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; network!&lt;/p&gt;

&lt;h2&gt;
  
  
  👏 Support this project
&lt;/h2&gt;

&lt;p&gt;If you enjoyed this article, please check out the &lt;a href="https://github.com/projectsveltos" rel="noopener noreferrer"&gt;Projectsveltos GitHub repo&lt;/a&gt;. You can also star &lt;a href="https://github.com/projectsveltos/addon-controller" rel="noopener noreferrer"&gt;🌟 the project&lt;/a&gt; if you found it helpful.&lt;br&gt;
The GitHub repo is a great resource for getting started with the project. It contains the code, documentation, and examples. You can also find the latest news and updates on the project on the GitHub repo.&lt;br&gt;
Thank you for reading!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>kubernetes</category>
      <category>devops</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
