Creating a Kubernetes cluster
To create a Kubernetes cluster, go to Infrastructure → Clusters.
Then press the "+ ADD CLUSTER" button and select the"Kubernetes Cluster" option.
After selecting this option, a window with the creation of a new Kubernetes cluster will appear. In the "GROUP" tab choose your group. Each tenant has one group by default.
In the "NAME" tab, complete the following fields:
- CLOUD - select the cloud you want to create cluster on,
- CLUSTER NAME - name of the new cluster,
- RESOURCES NAME - the name with which the cluster resources will begin. Taking the example from the photo below, “RESOURCES NAME” has the name "wek-k8s" entered. So all resources will start with this name, e.g. wek-k8s-master or wek-k8s-worker-2.
In the "CONFIGURE" tab, you can enter the cluster configuration. Complete the following fields:
- LAYOUT - You can choose whether you want to create a cluster with HA or not. A cluster with HA assumes the creation of 3 masters, without HA only one. At the moment, the cluster can be created with Ubuntu 16.04,
- PLAN - plan with which the master instances will be created. The plan "xsmall" is not listed due to the fact that instances in the cluster must have min. 2 cores.
- VOLUME - The size of the master instances adapts to the selected plan. We recommend changing the option from "Volume" to "Local",
- NETWORK - select the network under which the cluster will be created, each tenant has its own network,
- AVAILABILITY ZONE - select the "nova" option,
- SECURITY GROUP - security group that will be attached to each instance in the cluster. In the example below, a group that opens all ports has been selected, but you can create your own group before creating the cluster. However, remember that the lack of some open ports may result in the cluster being unreachable,
- FLOATING IP - select the "external" option. If this option is not selected, the cluster will not be reachable. If for example you want to create a cluster with HA (3 masters) and additionally 3 workers, 6 Floating IP addresses will be taken from the external pool.
- WORKER PLAN - plan with which the worker instances will be created. The plan "xsmall" is not listed due to the fact that instances in the cluster must have min. 2 cores,
- NUMBER OF WORKERS - number of workers with which the cluster will be created.
After entering the configuration, press the "NEXT" button.
After entering the configuration, the cluster creation summary in the "REVIEW" tab will be displayed. If everything is correct, press the "COMPLETE" button.
The cluster will start to form. Master instances will be created first.
Clicking on the name of the cluster will go to the details about it. After creating and configuring the master instances, the worker instances will be created.
The larger the cluster was selected at the configuration stage, the longer the entire cluster will be created. After some time the cluster status should turn green (ok) which means that the cluster is ready. Select a cluster by clicking on its name.
In the bottom menu, in the "Summary" tab, there will be a summary of the entire cluster.
In the Master/Worker tabs you can view the instance of masters and workers with their public addresses.
In order to gain control over the cluster, first copy "Kube Config". To do this, press the "ACTIONS" button and select "View Kube Config".
Copy all the contents of config.
Then access the instance that has the Kubernetes command-line tool "kubectl". Master instances have such a tool built-in.
Copy the cluster configurations into this file. and then run the "kubectl get nodes" command with the "--kubeconfig" parameter pointing to the "config" file. You should get information about the cluster resources.
You can run this command without selecting the configuration file, but to do this go to the ".kube" folder. Create the "config" file again and paste the cluster configurations into it. Then go back to the previous directory and delete the "config" file you created at the beginning. Run the "kubectl get nodes" command again. Note that you did not have to specify a configuration file parameter.