Skip to content

Declarative Cluster Lifecycle Management

Every Kubernetes user is familiar with the kubectl apply command. This is used to create or modify Kubernetes resources as defined in a manifest file.

This pattern is referred to as Declarative usage where the state of the resource is "declared" in the manifest file and the command is used to implement the declared state. Unlike an imperative approach where the user needs to specify both what and how to perform a task, with the declarative approach, the user just needs to specify what to do and not worry about how to do it.

The apply approach is preferred and recommended because it is well suited for version control. The kubectl apply command works extremely well for resources inside the Kubernetes cluster.

What if there was a way to bring this declarative approach for cluster lifecycle management as well?

Automation for Cluster Lifecycle

The Rafay Kubernetes Operations platform has supported a declarative approach for cluster lifecycle management for all types of supported distributions and environments (EKS, AKS, GKE, VMware vSphere, Upstream Kubernetes) via all the supported interfaces.

In this blog, we will look at how many of our customers embed Rafay's RCTL CLI into their automation pipelines to easily manage the lifecycle of Kubernetes clusters using a declarative approach. Many of our customers have standardized on tools such as Jenkins, GitGub Actions etc. for their automation. It is trivial for them to embed Rafay's RCTL CLI to handle cluster lifecycle management. The diagram below describes the high level interaction between the pipeline and Rafay.

sequenceDiagram
    participant dev as Administrator
    participant git as Git Repository
    participant pipe as Pipeline <br> (with RCTL CLI)
    participant rafay as Rafay
    participant cloud as Infrastructure 

    dev->>git: PR & Commit <br> "Cluster Spec"
    git-->>pipe: Webhook
    pipe->>git: Retrieve Cluster Spec

    rect rgb(191, 223, 255)
        note over pipe,rafay: Provision/Scale/Upgrade Cluster
        pipe->>rafay: "rctl apply -f spec.yaml"
    end
    rafay->>cloud: Update Cluster

All customers prefer to maintain version controlled declarative specifications for their clusters in a Git repository. When they would like to make any updates to their cluster, they just update the cluster specs in Git which is detected by the pipeline. The significant advantage with Rafay's approach is that the business logic they need to implement in their pipelines is BRUTALLY SIMPLE. In a nutshell, the pipeline needs to worry about just 2 commands (apply and delete) in the RCTL CLI.

Operation Description
Provision rctl apply -f spec.yaml
Scale rctl apply -f spec.yaml
Upgrade rctl apply -f spec.yaml
Update rctl apply -f spec.yaml
Delete rctl delete cluster

Next Steps

Learn more about declarative specifications for cluster lifecycle management for various Kubernetes distributions below. Review our curated Getting Started Guides based on declarative cluster specifications for cluster lifecycle management.

Distribution Declarative Specs
Amazon EKS Specification
Azure AKS Specification
Google GKE Specification
Upstream Specification

Sincere thanks to readers of our blog who spend time reading our product blogs and suggest ideas and topics. Please Contact the Rafay Product Team if you would like us to write about other topics.