Connect a Kubernetes cluster

Microtica offers a complete solution to setup Kubernetes infrastructure in the cloud, as well deploy and monitor services from integrated Kubernetes Dashboard.

You can provision a complete Kubernetes cloud infrastructure through Microtica but you can also connect your existing Kubernetes cluster running on basically any cloud provider or on-premise.

Microtica K8s is fully integrated with Microtica pipelines so you can easily define your automation to build, test and deploy services on Kubernetes in one place.

#Setup a new Kubernetes cluster

In Microtica you can quickly setup a complete Kubernetes infrastructure by using our ready-to-use components.

As a prerequisite, you would need to have an environment where you would build the Kubernetes infrastructure. For start, you would only need our ready-to-use VPC and EKS component.

If you setup the cluster using Microtica, you won’t need to deal with any integration details, provisioning access tokens etc. it will all be managed automatically by Microtica.

For a complete walkthrough of how to setup Kubernetes cluster please follow our Kubernetes Getting Started guide.

#Connect your existing Kubernetes cluster

In case you have an existing Kubernetes cluster running on your cloud account or on-premise and you want to use the full capabilities of Microtica’s Kubernetes automation you can do that by simply connecting your existing cluster through Microtica Portal.

There is no difference in features we provide if you choose to setup Kubernetes with Microtica or you connect your existing cluster. You get the same user experience in both cases.

Prerequisites

If your cluster is behind a firewall make sure that you enable inbound access from these IP addresses:

  • 52.29.192.164

Connect with EKS cluster

Before we can create all necessary resources needed to integrate with the cluster we should first establish a successful connection with the cluster.

To establish a connection with your EKS cluster please follow this guide.

Prepare the cluster

Now that we established a successful connection with the cluster, we can proceed with the integration preparation.

For Microtica to be able to interact with your cluster, we should create certain roles and assign proper permissions using RBAC. Then generate a secret that will be used in the integration later on. If you already have an access secret you can skip this step.

Execute the following command in the terminal to create new microtica namespace:

kubectl create namespace microtica

And below is an example of Kubernetes manifest that creates service account, cluster role and access secret:

api-access.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: microtica
secrets:
- name: microtica-secret
---
apiVersion: v1
kind: Secret
metadata:
  name: microtica-secret
  annotations:
    kubernetes.io/service-account.name: microtica
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: microtica-user
rules:
- apiGroups: [ "", "extensions"]
  resources: ["*"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: microtica-rbac
subjects:
- kind: ServiceAccount
  namespace: microtica
  name: microtica
roleRef:
  kind: ClusterRole
  name: microtica-user
  apiGroup: rbac.authorization.k8s.io

Create role and access secret:

kubectl apply -f api-access.yaml -n microtica

Get the token from the secret in Base64 format:

kubectl get secret microtica-secret -n microtica -o jsonpath='{.data.token}' | base64 --decode

Save the token value in the clipboard, we will need it in the next step.

Attach the cluster in Microtica Portal

The last thing we need to do is to attach the cluster in Microtica Portal.

Click on Clusters under Kubernetes from the left menu. Then click on Connect Kubernetes button on the top right.

Enter the Kubernetes integration details in the modal and click on Connect Kubernetes button.

Connect Kubernetes modal

If the integration is successful you will receive a success message. If you receive an error message check if the values for API token and Endpoint are correct and try again.

The new cluster is now available in the list of clusters.

List of Kubernetes clusters

To access the Kubernetes Dashboard click on the cluster and you will be redirected to a detailed cluster page.

Microtica Kubernetes Dashboard