At this point, you should have installed MKE - using the DC/OS kubernetes
package on your DC/OS Enterprise cluster and installed the latest DC/OS Kubernetes CLI. As when installing the MKE, to run this Kubernetes cluster as a service on our DC/OS Enterprise cluster, we need a service account for it. Like before, to do so we need to first provision a service account for this Kubernetes cluster, then grant it the necessary permissions for operating on DC/OS Enterprise.
Provision a Service Account for DC/OS Kubernetes
As with MKE on DC/OS Enterprise, when installing DC/OS Kubernetes on a DC/OS Enterprise cluster, configuring a service account for DC/OS Kubernetes on Enterprise is necessary. Since the pattern is similar here, we will move through it just a little faster than when provisioning the service account for MKE earlier.
-
Start by creating a unique keypair to use for the service account, here we specify
kube1-priv.pem
andkube1-pub.pem
:You will find the resulting keypair in your working directory. As before, no other output is produced when the command is run successfully.
-
Now, create a service account this first Kuberneters cluster,
kubernetes-cluster1
, associated with the public key.In this case, enter:
-
Then, associate a secret with the cluster’s service account using the newly generated private key.
Again, it is expected behavior in these steps for no output from the CLI to happen unless an error has occurred.
Grant Permisions
We provide code snippets here for ease of granting the necessary permissions. After all, you have already learned some of this pattern when setting up the service account for MKE previously. The list of commands is certainly a fair bit more extensive here but the pattern is similar.
Copy and Paste in Groups
If everything has gone right up until here, you should be able to paste these permissions in the following grouping of dcos security
commands at a time without any errors. Here we have the Mesos master node permissions for creating and deleting tasks and reservations, followed by the secret permissions for the cluster, admin router permissions, and public agent node permissions.
-
Enter master node permissions:
-
Enter secret permissions:
-
Enter Admin Router permissions:
-
Enter public agent permissions:
Again, as before, you should not receive any feedback in your CLI when these commands run successfully.
Create your first Kubernetes cluster
Now that permissions have been granted to the service account, we need to make sure that the package installer is aware of the account.
-
First, open the options JSON file associated with the account. If you do not already have an options JSON file, create a new one. In the CLI, enter:
This will create the file in your current working directory, in this example we name the file
kubernetes1-options.json
. -
Open the file in a text editor and add the service account information.
Place the following snippet in the newly configured
kubernetes1-options.json
file:Save and close the file.
-
Initiate the Kubernetes cluster creation using the associated
kubernetes1-options.json
configured for the package in last step..In the CLI, enter:
You can easily use the DC/OS Kubernetes CLI to monitor your Kubernetes cluster creation by running the following:
When successful, you will see the complete cluster plan, like shown here:
Create a second Kubernetes cluster on your DC/OS cluster
You are now going to follow the same pattern to create kubernetes-cluster2
as used to create the first cluster, kubernetes-cluster1
.
It is a good practice to use of a different keypair to be used with the service account, so as to not mix this keypair up with any of the others we are using. As before, paste in the following snippets to your CLI, just as we just did for the first cluster:
-
Create the
kubernetes-cluster2
service account: -
Grant the
kubernetes-cluster2
service account the required permissions for Kubernetes clusters:As usual, no output is expected upon successfully granting permissions.
-
Next, create an options JSON file for this cluster named
kubernetes2-options.json
:This options JSON provides an example of some of the configuration options available, listing some of the variable names and their default values. In this example, we will be deploying with
"kube_cpus": 1
, instead of the default value of2
.Use the following to create
kubernetes2-options.json
: -
Create the
kubernetes-cluster2
cluster with the options JSON file you just created:Using the DC/OS Kubernetes CLI, enter the following command:
and your Kubernetes cluster service should start spinning up.
-
As above, to monitor
kubernetes-cluster2
while being created, use the DC/OS Kubernetes CLI:And you should receive output similar to the following:
If you use your GUI, you should see both clusters and the MKE as services in under Services.
Next Step: Connecting to Kubernetes on DC/OS Enterprise
Nice work! You now have multiple Kubernetes clusters running throughout your DC/OS Enterprise cluster. With the internal workings of the cluster all set, you can move on to Configuring Edge-LB to set up a load balancer for your cluster.