Docker Enterprise from Mirantis is the fastest way to create modern applications, but despite its power, it’s pretty easy to set up and get started. In this article, we’re going to assume you’ve installed Docker Enterprise using the Mirantis Launchpad CLI Tool, get familiar with using the Universal Control Plane to create and manage Kubernetes objects, add an additional node to the cluster, and learn how to access it from the command line.
Let’s get started.
Accessing Docker Enterprise Universal Control Plane
The first thing we need to do is initialize the cluster:
- When you installed Docker Enterprise with Mirantis Launchpad, you got a message such as:
INFO Cluster is now configured. You can access your cluster admin UI at: https://ec2-34-222-249-19.us-west-2.compute.amazonaws.com INFO You can also download the admin client bundle with the following command: launchpad download-bundle --username
- Copy the URL to your browser and access it to get to the login screen. (You may have to tell it to ignore certificate warnings.)
- Log in using the username and password you specified in your cluster.yaml file, as in:
apiVersion: launchpad.mirantis.com/v1beta1 kind: UCP metadata: name: ucp-kube spec: ucp: installFlags: - --admin-username=admin - --admin-password=passw0rd! - --default-node-orchestrator=kubernetes hosts: - address: ec2-34-222-249-19.us-west-2.compute.amazonaws.com user: ubuntu ...
- If you have one, click Upload License and choose your *.lic file, or click Skip For Now.
Accessing the Kubernetes cluster using UCP
When you run Launchpad, it creates a cluster capable of hosting both Kubernetes and Docker Swarm nodes. In this case, let’s look at how to access the cluster using Kubernetes tools.
Follow these steps to use the UI to create and manage individual objects:
- Choose Kubernetes -> + Create to create any type of object using YAML.
- In this case, let’s create a couple of different objects using the following YAML:
apiVersion: v1 kind: Service metadata: name: nginx labels: app: nginx spec: selector: app: nginx ports: - port: 80 name: http targetPort: 80 - port: 443 name: https targetPort: 80 --- apiVersion: v1 kind: Pod metadata: name: rss-site labels: app: web spec: containers: - name: front-end image: nginx ports: - containerPort: 80 - name: rss-reader image: nickchase/rss-php-nginx:v1 ports: - containerPort: 88
- Click Kubernetes -> Namespaces, then highlight kube-public and click Set Context to tell UCP to choose this namespace.
- Now choose Kubernetes -> Pods and you’ll see the Pod you just created.
- You can also use the Actions pulldown to remove objects.
Accessing the Docker Enterprise Kubernetes cluster from the CLI
In order to access the Kubernetes cluster from the command line, you will need to do two things:
- Install kubectl
- Download the client bundle from UCP to set the context and provide credentials
There’s no special tool for accessing the Kubernetes cluster, so you can use the normal kubectl install instructions to complete step 1. Fortunately, step 2 is just as easy. Follow these instructions:
- Click Dashboard and scroll down to find the Docker CLI information box.
- Click the arrow to open the Create and Manage Services Using the CLI dialog box.
- Now you’ll need to create the client bundle. To do that, click the user profile page link. This link opens a new tab that enables you to create a new bundle.
- Click New Client Bundle and select Generate Client Bundle, then enter a label and click Confirm.
- When you click Confirm, the bundle will download automatically. There won’t be any dialog box or other indication, but don’t panic, it’s in your Downloads folder. On the command line of your local machine (where you downloaded the bundle), you’ll want to extract the environment script and execute it. If you’re using Linux, this set of commands is:
unzip ucp-bundle-admin.zip eval "$(
Note that this assumes that you’re using the admin user; make sure to use the actual filename.
For Windows, simply unzip the archive and run
- At this point your kubectl client is configured to access the Kubernetes cluster. To test it, type
$ kubectl get pods -n kube-public NAME READY STATUS RESTARTS AGE rss-site 2/2 Running 0 1d
The first time you run this command, it may take a few seconds to get a response, but you should see the pods we created earlier.
Now that you know how to access the Kubernetes cluster, let’s look at adding an additional node to that cluster.
Adding a new node to a Docker Enterprise cluster
The last thing we want to do in this article is to add another node to the cluster so you can see how that is done. Using Mirantis Launchpad CLI Tool, it’s a simple matter of adding the new server to the cluster.yaml file and applying it. For example, I started with two servers, and now I’ve added a third:
apiVersion: launchpad.mirantis.com/v1beta1 kind: UCP metadata: name: ucp-kube spec: ucp: installFlags: - --admin-username=admin - --admin-password=passw0rd! - --default-node-orchestrator=kubernetes hosts: - address: ec2-34-222-249-19.us-west-2.compute.amazonaws.com user: ubuntu role: manager sshKeyPath: /Users/nchase/Downloads/kaas.pem - address: ec2-35-160-242-135.us-west-2.compute.amazonaws.com user: ubuntu role: worker sshKeyPath: /Users/nchase/Downloads/kaas.pem - address: ec2-18-237-127-216.us-west-2.compute.amazonaws.com user: ubuntu role: worker sshKeyPath: /Users/nchase/Downloads/kaas.pem
From there, if we go ahead and re-execute:
launchpad apply ... INFO ==> Running phase: Join workers INFO ec2-35-160-242-135.us-west-2.compute.amazonaws.com: already a swarm node INFO ec2-18-237-127-216.us-west-2.compute.amazonaws.com: This node joined a swarm as a worker. INFO ec2-18-237-127-216.us-west-2.compute.amazonaws.com: joined succesfully INFO ==> Running phase: Close SSH Connection INFO ec2-18-237-127-216.us-west-2.compute.amazonaws.com: SSH connection closed INFO ec2-35-160-242-135.us-west-2.compute.amazonaws.com: SSH connection closed INFO ec2-34-222-249-19.us-west-2.compute.amazonaws.com: SSH connection closed INFO ==> Running phase: UCP cluster info INFO Cluster is now configured. You can access your cluster admin UI at: https://ec2-34-222-249-19.us-west-2.compute.amazonaws.com INFO You can also download the admin client bundle with the following command: launchpad download-bundle --username
As you can see, the new node gets added to the cluster. You can see that if you choose Shared Resources -> Nodes.
At this point, you’ve got a fully-functional Kubernetes cluster running on Docker Enterprise, and you can do anything you’d normally do with Kubernetes with it. Stay tuned for upcoming tutorials on using Istio Ingress, GPUs, and Windows nodes with Kubernetes, or join us to see them in action. And if you haven’t tried Mirantis Launchpad CLI Tool yet, now is the time!