Skip to content

Working with Kubernetes clusters

Kubernetes is an open-source project to manage containers at scale. You can easily integrate your Kubernetes clusters on Razorops and execute kubectl commands as part of workflows.

It integrates well with hosted Kubernetes on major cloud platform like Google GKE, Azure AKS, and AWS EKS, etc. It works with any Kubernetes cluster if the master API server is reachable.

Connect Cluster

To connect a Kubernetes cluster, first you need to generate kubeconfig credentials and add it to our Dashboard under "Kubernetes" tab. These credentials will be injected into your workflows.

  1. Visit the Kubernetes section of Razorops Dashboard, select Add Cluster.

  2. Give your Kubernetes cluster a name under Name and paste the kubeconfig credentials into the Kubernetes Config space of the dialog. The name will be available as kubeconfig context in the workflows.

  3. Select Add Cluster to complete.

Success! After adding your Kubernetes credentials, you can confirm installation under the Kubernetes section. The green status confirms the connection is successful and ready to be used.

How to use in workflows

The tasks in your workflows will be configured to fetch the credentials automatically and store it at standard path (~/.kube/config). You can use kubectl CLI or any tool as part of your steps to talk to the Kubernetes cluster. if you have connected multiple Kubernetes clusters, it's recommended to change the context before executing the commands.

For example -

    ...
    steps:
    - commands:
      - kubectl version
      # activate the context by cluster name 
      - kubectl config use-conetxt <cluster-name> 

      # Update the deployment `hello` docker image to rollout a new version
      - kubectl set image deployment.apps/hello hello=example.com/hello
    ...