Please note: Mirantis has realigned its portfolio and renamed several products. These include Docker Enterprise Container Cloud (now Mirantis Container Cloud), Docker Enterprise/UCP (now Mirantis Kubernetes Engine), Docker Engine - Enterprise (now Mirantis Container Runtime), and Docker Trusted Registry (now Mirantis Secure Registry).

Create and manage an OpenStack-based KaaS child cluster

Once you’ve deployed your KaaS management cluster, you can begin creating actual Kubernetes child clusters. These clusters will use the same cloud provider type as the management cluster, so if you’ve deployed your management nodes on OpenStack, your child cluster will also run on OpenStack.

The general process looks like this:

  1. Create an empty cluster.
  2. Add machines to the cluster.  As part of this process, Kubernetes gets deployed on the machines.
  3. Download the KUBECONFIG so that you can access the cluster.  

We’re going to cover all of those steps in this article.  Let’s start by creating the cluster.

Create a child cluster

We’ll start by creating a child cluster based on OpenStack.  The general process for using other cloud providers is similar.

  1. The first thing we need to do is gather artifacts from the host cloud itself.  Log into your OpenStack Horizon dashboard and click API Access -> Download OpenStack RC file –> OpenStack clouds.yaml file.
    screenshot of OpenStack Horizon's API Access tab with OpenStack clouds.yaml File selected from Download OpenStack RC File dropdown
  2. Next we need the SSH key we’ll use to access the host machines.  If you haven’t already got one, you can create a new one from the command line. Make note of the file in which you store it:
    $ ssh-keygen -t rsa -b 4096 -C "you@example.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/nchase/.ssh/id_rsa): kaas 
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in kaas.
    Your public key has been saved in kaas.pub.
    The key fingerprint is:
    SHA256:DKSxJ6ChGJJwwBnUPd3kEAXxn4TmKpTTKObCd3vtAeo you@example.com
    The key's randomart image is:
    +---[RSA 4096]----+
    |X=* o o=Bo       |
    |=B o B .+..      |
    |+   + + = .     |
    |     o+oo o .    |
    |   o = oS. o     |
    |. o o o o        |
    | o o + ...       |
    |  o o o. ..      |
    |     E. ..       |
    +----[SHA256]-----+
  3. Now log in to the KaaS web UI using credentials for a user with either operator or  writer permissions.  Your administrator will have set this up ahead of time.  (If you are the administrator, see the documentation for information on creating users.)
    screenshot of sign in window for KaaS web UI
  4. Select the required namespace.  Your administrator will have set this up ahead of time as well.  (Again, if you are the administrator, see the documentation.)
    screenshot of Namespaces window depicting imc-marketing-team as active
  5. On the upper right side of the namespace page, click SSH keys -> Add SSH Key.
    .screenshot of upper right side of Namespaces window showing SSH Keys tab selected
  6. Name your key and click Upload Key to upload the public key file.  Make sure that you don’t upload the private key; for example, we named our key kaas, so the public key file is kaas.pub.
    screenshot of Add New SSH Key window with the Name and Public Key sections already filled out
  7. On the upper right side of the namespace page, click Credentials -> Add Credential.
    screenshot of upper right corner of Namespace page with Credentials tab selected
  8. You can add the cloud information manually, but it’s typically much easier to click the upload clouds.yaml link and upload the file we created in step 1. Uploading the file will auto-populate all of the required fields except the Password, which you’ll have to enter manually.  This is the same password you used to log into Horizon.
    screenshot of Add New Credential Window with clouds.yaml link already uploaded and all Credential fields populated
  9. Scroll down and click the Create button to finish creating the credential.
    screenshot of the bottom half of the Add New Credential Window with related fields already populated
  10. Go back to the Clusters tab and click Create Cluster.
    screenshot of Clusters tab with progress circle spinning next to the Create Cluster button
  11. Name your cluster and decide what features you want to enable.  KaaS enables you to add create clusters with Istio service mesh, Harbor registries, and the Kubernetes dashboard by simply clicking checkboxes.  You can also enable the StackLight Logging, Monitoring and Alerting option, as well as configuring alerts. For the moment, however, we’re going to stick with a vanilla cluster — just Kubernetes. At the time of this writing, the most current version of Kubernetes available is 1.15.3, but you have the option to choose Kubernetes 14.6.  You always have the option to update your clusters, and as new versions are added to KaaS they will be made available in the UI.Click Create to create the empty cluster.screenshot of Create New Cluster window for the empty cluster just created
  12. Now you’ve got a cluster. When the PENDING status disappears, you can add actual capacity to it.
    screenshot of Clusters tab with newly created empty cluster now visible in list of clusters

Add Machines to your KaaS cluster

Now that you have a cluster, you need to add machines on which the cluster will actually run.  For a bare metal cluster, those machines will be actual servers, but for an OpenStack-based cluster, they will be OpenStack VMs.  (Note that you don’t create these VMs manually; KaaS will take care of it for you in the background.)

Once you add machines to a cluster through the UI, KaaS automatically provisions them and adds them to the actual Kubernetes cluster, so you can also use these instructions for scaling up your KaaS child cluster.

  1. Choose the Machines tab, then click the Create Machine button.
    screenshot of Machine tab with progress circle spinning next to the Create Machine button
  2. Let’s start by creating the control plane.  Because we are deploying HA clusters by default, we want a minimum of 3 control plane nodes, so we’ll specify 3 and click the Control Plane checkbox.
    screenshot of Create New Machine window for the new machine just created
    screenshot of the bottom half of the Add New Machine Window with relevant fields already populated
    Select the SSH key we added earlier and designate a username to associate with it, such as ubuntu.  In this case, the flavor and image are OpenStack parameters, as is the Availability Zone.Click Create to add the machines to the cluster.
  3. KaaS will create the machines and assign them an IP address.  You can watch this progress from the Machines tab.
    screenshot of Machine tab with three virtual machines listed and progressing as the Mirantis KaaS Beta works to assign them an IP address
  4. While we’re waiting on these servers, we can go ahead and add two compute nodes, the minimum a KaaS cluster.  The process is exactly the same, except that we don’t check the Control Plane box. You might also decide to use larger machines, since they are actually going to be hosting your workloads.
    screenshot of Create New Machine window with with Control Plane box unchecked and all other relevant fields already populated
  5. It will take a few minutes, but the machines will cycle through deployment status of Pending, then Updating, and finally to Ready.  If you check your OpenStack dashboard, you’ll gradually see these machines come online.
    screenshot of OpenStack dashboard with Instances tab open showing the machines just created cycling through their deployment status until completion

When the cluster is ready, we can try it out.

Testing the deployed Kubernetes cluster

Once the machines in the cluster show a status of READY you can test it out.  

  1. Start by downloading the kubeconfig by going to the Clusters tab and clicking the arrow for the cluster you want to use.
    screenshot of upper right corner of Clusters tab showing Download kubeconfig icon selected
  2. Enter your KaaS password and click Download.
    screenshot of Download Kubeconfig window with blank dialog box for user to enter his or her password
  3. Make sure you have the kubectl client installed according to the instructions for your operating system.
  4. Next you’ll need to go to the command line and point to the kubeconfig file you downloaded in steps 1 and 2:
    $ export KUBECONFIG=~/Downloads/kubeconfig-kaasdemo.yml
  5. Now you can go ahead and check what resources are available:
    $ kubectl get nodes
    NAME                                             STATUS ROLES AGE VERSION
    kaas-node-3cd4e4eb-7832-4ef8-a1c6-d1cc8ffca8dd   Ready <none> 20m v1.15.3-8+d06f4e3032941e
    kaas-node-5d541aac-c52c-4c21-a867-5bc621926e81   Ready master 21m v1.15.3-8+d06f4e3032941e
    kaas-node-81df4422-8c99-4d00-9108-52a003b45bae   Ready master 18m v1.15.3-8+d06f4e3032941e
    kaas-node-8917ae73-e715-49e1-8684-c11d3b4216b2   Ready master 25m v1.15.3-8+d06f4e3032941e
    kaas-node-ee1f417d-9e57-4c0b-8952-7fc9c9363fa8   Ready <none> 20m v1.15.3-8+d06f4e3032941e
    $ kubectl get namespaces
    NAME              STATUS AGE
    default           Active 25m
    kube-node-lease   Active 25m
    kube-public       Active 25m
    kube-system       Active 25m

Now you have a fully functional Kubernetes cluster you can use like any other.  

What to try it out for yourself?  Download the Mirantis KaaS public beta!

WEBINAR RECORDING
What's New in Kubernetes 1.18
WATCH NOW