Mirantis Kubernetes Engine

Mirantis Kubernetes Engine (MKE) is a container orchestration platform for developing and running modern applications at scale, on private clouds, public clouds, and on bare metal.

MKE as a container orchestration platform is especially beneficial in the following scenarios:

  • Orchestrating more than one container
  • Robust and scalable applications deployment
  • Multi-tenant software offerings

The following sections describe how to deploy a single-node YugabyteDB cluster on Mirantis MKE using kubectl and helm.

This page describes the steps for a single-node cluster for the purpose of simplicity, as you require more than one machine/VM for a multi-node cluster deployment.

Prerequisite

Before installing a single-node YugabyteDB cluster, ensure that you have the Docker runtime installed on the host on which you are installing MKE. To download and install Docker, select one of the following environments:

Docker for Mac

Docker for CentOS

Docker for Ubuntu

Docker for Debian

Install and configure Mirantis

  1. Install MKE docker image as follows:

    docker image pull mirantis/ucp:3.5.8
    
    docker container run --rm -it --name ucp \
          -v /var/run/docker.sock:/var/run/docker.sock \
          mirantis/ucp:3.5.8 install \
          --host-address <node-ip> \ // Replace <node-ip> with the IP address of your machine.
          --interactive
    

    When prompted, enter the username and password that you want to set; these are used to access the MKE web UI.

  2. Install and configure kubectl with MKE, and install Helm using the instructions in MKE documentation.

  3. Create a new storage class using the following steps:

    1. ​​Copy the following content to a file named storage.yaml:

      apiVersion: storage.k8s.io/v1
      kind: StorageClass
      metadata:
       name: yb-storage
      provisioner: kubernetes.io/no-provisioner
      volumeBindingMode: WaitForFirstConsumer
      
    2. Apply the configuration using the following command:

      kubectl apply -f storage.yaml
      
  4. Make the new storage class default as follows:

    kubectl patch storageclass yb-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
    
  5. Verify that the storage class is created using the following command:

    kubectl get storageclass
    
    NAME                 PROVISIONER                   RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
    yb-storage(default)  kubernetes.io/no-provisioner  Delete          WaitForFirstConsumer   false                  23s
    
  6. Create four PersistentVolumes(PVs) using the following steps:

    1. Copy the following PersistentVolume configuration to a file volume.yaml:

      apiVersion: v1
      kind: PersistentVolume
      metadata:
        name: task-pv-volume1
        labels:
          type: local
      spec:
        storageClassName: yb-storage
        capacity:
          storage: 10Gi
        accessModes:
           - ReadWriteOnce
        hostPath:
          path: "/mnt/data"
      
    2. Apply the configuration using the following command:

      kubectl apply -f volume.yaml
      
    3. Repeat the preceding two steps to create the remaining PVs : task-pv-volume2, task-pv-volume3, and task-pv-volume4 by changing the metadata name in volume.yaml for each volume and re-running the kubectl apply command on the same file.

  7. Verify PersistentVolumes are created using the following command:

    kubectl get pv
    
    NAME             CAPACITY   ACCESS MODES    RECLAIM POLICY    STATUS     CLAIM   STORAGECLASS  REASON  AGE
    task-pv-volume1  10Gi       RWO             Retain            Available          yb-storage            103s
    task-pv-volume2  10Gi       RWO             Retain            Available          yb-storage            82s
    task-pv-volume3  10Gi       RWO             Retain            Available          yb-storage            70s
    task-pv-volume4  10Gi       RWO             Retain            Available          yb-storage            60s
    

Deploy YugabyteDB

Download YugabyteDB Helm chart

To download and start YugabyteDB Helm chart, perform the following:

  1. Add the charts repository using the following command:

    helm repo add yugabytedb https://charts.yugabyte.com
    
  2. Fetch updates from the repository using the following command:

    helm repo update
    
  3. Validate the chart version as follows:

    helm search repo yugabytedb/yugabyte --version 2.17.2
    
    NAME                 CHART VERSION   APP VERSION    DESCRIPTION
    yugabytedb/yugabyte  2.17.2          2.17.2.0-b216  YugabyteDB is the high-performance distributed ...
    

Create a cluster

Create a single-node YugabyteDB cluster using the following command:

kubectl create namespace yb-demo
helm install yb-demo yugabytedb/yugabyte \
    --version 2.17.2 \
    --set resource.master.requests.cpu=0.5,resource.master.requests.memory=0.5Gi,\
    resource.tserver.requests.cpu=0.5,resource.tserver.requests.memory=0.5Gi,\
    replicas.master=1,replicas.tserver=1 --namespace yb-demo

Check cluster status with kubectl

Run the following command to verify that you have two services with one running pod in each: one YB-Master pod (yb-master-0) and one YB-Tserver pod (yb-tserver-0):

kubectl --namespace yb-demo get pods
NAME          READY     STATUS             RESTARTS   AGE
yb-master-0   0/2       ContainerCreating  0          5s
yb-tserver-0  0/2       ContainerCreating  0          4s

For details on the roles of these pods in a YugabyteDB cluster, refer to Universe.

The status of all the pods change to Running state in a few seconds, as per the following output:

NAME          READY     STATUS    RESTARTS   AGE
yb-master-0   2/2       Running   0          13s
yb-tserver-0  2/2       Running   0          12s

Connect to the database

Connect to your cluster using ysqlsh, and interact with it using distributed SQL. ysqlsh is installed with YugabyteDB and is located in the bin directory of the YugabyteDB home directory.

  1. To start ysqlsh with kubectl, run the following command:

    kubectl --namespace yb-demo exec -it yb-tserver-0 -- sh -c "cd /home/yugabyte && ysqlsh -h yb-tserver-0 --echo-queries"
    
    ysqlsh (11.2-YB-2.1.0.0-b0)
    Type "help" for help.
    
    yugabyte=#
    
  2. To load sample data and explore an example using ysqlsh, refer to Retail Analytics.

Access the MKE web UI

To control your cluster visually with MKE , refer to Access the MKE web UI.