How to Deploy a Kubernetes Cluster by Using the CLI

To deploy and manage Kubernetes in vCloud, you can use the Container Service Extensions tool.

An important note: working with the tool requires command line and python3 application skills.

Preferences

These settings are mandatory, otherwise it will be impossible or very difficult to deploy the kubernetes cluster.

First of all, you need to create a network for the Kubernetes cluster. To do this, in the Cloud Control Panel, in the menu on the left side of the screen, you need to go to the 'Networks' section and click the 'ADD' link above the list of networks. This will open the network creation wizard.

On the first page of the wizard, select the type of network - Routed (after completing the settings on each page, click 'Next').

On the second page, enter the network name and address (these are not important, e.g. k8s_net and 10.0.8.1/24).

On the third page, select the Edge Gateway to which the network will be connected.

On the fourth page - the dhcp address pool, on the fifth - the DNS server. On the last page, you will be asked to review and accept the settings. When the wizard is finished, wait for the network to be created.

The next step is to provide Internet access from the created network (required during the cluster deployment phase) and access to the cluster network from your cloud and the Internet (if required). To provide Internet access, you will need to add the snat rule to the Edge's NAT settings, which will forward subnet addresses to the external IP.

Next, from any virtual machine in your vCloud, check the availability of the Kubernetes cluster network (with the command ping <gateway_address>, in our example ping 10.0.8.1) and configure firewall rules if necessary. It is recommended to configure the cluster network access to the Edge SSL VPN, its configuration is described in this article:

https://client.cloud4u.com/index.php/knowledgebase/133/Remote-Access-SSL-VPN-Plus.html?language=english 

The final stage of the preparation is to generate RSA keys for password-free access to the cluster. The need for this step is related to the fact that password access is disabled by default. In Linux, you can generate a key using the ssh-keygen command, in Windows you can use the key generator in the putty toolkit.

Client installation

It is assumed that the system from which the cluster is to be deployed already has the required version of python3 installed (at least 3.7.3 for cse version 2.5.1, for later versions the requirements should be checked in the cse documentation). If the correct version of python3 is not installed, you should install it according to the official installation instructions for your operating system (details: https://www.python.org/doc )

First you should install vcd-cli:

pip3 install vcd-cli

Then you need to authenticate to the vCloud by running the command:

vcd login vcd.cloud4u.com orgname username,

where

orgname - the name of your organisation (for example, demo-petrov, gazprom)        

username - the username of a user with administrator rights in your vCloud organization (this user is usually logged in to the Cloud Control Panel). The command prompts for a user password.

If the authorization is successful, the following message is displayed: administrator logged in, org: 'demo-petrov', vdc: 'demo-petrov_VDC_hk41'.

After successful authorization, the configuration file is created, on Linux systems ~/.vcd-cli/profiles.yaml (on Windows 10, Windows Server 2016 and higher - .vcd-cli\ profiles.yaml). The following lines should be added to the end of this file (following the yaml syntax):

extensions:

  - container_service_extension.client.cse

Now you can install the cse:

pip3 install container-service-extension

Check that the installation is correct:

vcd cse version

The result should be one line:

CSE, Container Service Extension for VMware vCloud Director, version x.x.x.

Note – Errors during the installation of vcd-cli and cse, as well as messages about the inability to load the container_service_extension.client.cse module, indicate an incompatible version or incorrect installation or configuration of python3. On some systems it is recommended to use pip3.7 install instead of pip3 install. The message "No such command "cse" indicates an error in the profiles.yaml configuration file.

Cluster deployment

To deploy the cluster, run the command:

vcd cse cluster create <cluster name> --network <name of the network> --ssh-key <path to rsa key> --nodes <cluster nodes number> --enable-nfs

If the error Error: Session has expired or user is not logged in. Please re-login is displayed, repeat the authorization procedure as described in the previous section.

If successful, the cluster will be created in a separate vApp. You can view the creation process in the vCloud web interface.

 

Have you tried Cloud4U cloud services? Not yet?

Go to the Main Website

Try for free

  • 120 Users Found This Useful
Was this answer helpful?

Related Articles

Preparation for use, client installation

  In order to create / edit / use Kubernets in vCloud Director, it is necessary to use the CSE...

NFS node management and PV creation

  Advantages of using NFS in Kubernetes   Using existing storage. You can mount an existing...

Managing a Kubernetes cluster

Overview Learn the basic commands that allow users to create, manage, and delete Kubernetes...

Adding a network load balancer

Данная инструкция описывает как настроить баллансировщик для Kubernetes Cluster созданного c...

Introduction to CSE

The Container Service Extension (CSE) is an extension to VMware Cloud Director (VCD) that helps...