This topic provides instructions to install the Kubernetes.
Note: If the deployment host does not have Internet connectivity to download the required files from VMware Customer Connect, follow the steps described in the
DarkSite Deployment section to get the files onto the deployment host. Then proceed with the remaining steps in this section.
Procedure
- Log in to the deployment host.
- Download the Deployment Container onto the deployment host. The container has tools and utilities needed for Kubernetes deployment. Pull the Deployment Container from the registry projects.registry.vmware.com/tcx/ which is publicly accessible and is hosted on VMware registry by running the following command using the specific tag.
$ docker pull projects.registry.vmware.com/tcx/deployment:2.2.0-6
- Download the K8s Installer from VMware Customer Connect onto the deployment host under the home directory. Typically this package is named as VMware-K8s-Installer-<VERSION>-<BUILD_ID>.tar.gz. For example, VMware-K8s-Installer-1.0.0-113.tar.gz.
Note: To verify the downloaded package, run the following command on your deployment host.
$ sha256sum VMware-K8s-Installer-<VERSION>-<BUILD_ID>.tar.gz
This command displays the SHA256 fingerprint of the file. Compare this string with the SHA256 fingerprint provided next to the file in the VMware Customer Connect download site and ensure that they match. - Extract the K8s Installer as follows. This creates a folder called
k8s-installer
under the home directory.$tar -xzvf VMware-K8s-Installer-<VERSION>-<BUILD_ID>.tar.gz
- Change into the
k8s-installer
to see the folders named scripts and cluster. - Create a directory /opt/vmware/tcx and move the cluster folder entirely under /opt/vmware/tcx.
- In the
k8s-installer
directory, edit the scripts/ansible/ansible.cfg file and set the value of thelog_path
parameter as follows:log_path=/root/ansible.log (replace /tmp) This writes the deployment log file (ansible.log) to $HOME on your host, which is mapped to the Deployment Container's /root as shown in the next step. This ensure's the log file is available after the Deployment Container exits.
- Launch the Deployment Container as follows:
docker run \ --rm \ -v $HOME:/root \ -v $HOME/.ssh:/root/.ssh \ -v $HOME/.kube:/root/.kube \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(which docker):/usr/local/bin/docker:ro \ -v $HOME/.docker:/root/.docker:ro \ -v /etc/docker:/etc/docker:rw \ -v /opt:/opt \ --network host \ -it projects.registry.vmware.com/tcx/deployment:2.2.0-6 \ bash
- cd into k8s-installer/scripts/deployment and update the following parameters in the deploy.settings file.
ADMIN_USERNAME=<Target-VM-username> ADMIN_PASSWORD=<Target-VM-password> ADMIN_PUBLIC_KEYS_PATH=<Location of SSH public key on the deployment host - NOTE the path should be with respect to the Deployment Container> # ========== Ansible and Kubespray ========== # DEPLOYER_BUNDLE_HOME=<location of the k8s-installer with respect to the Deployment Container> CONFIG_FILE=inventory.yml <leave as-is> CLUSTER_NAME=<your cluster name> KUBE_MASTERS=1 <leave as-is> IPS=(<space>ip1,ip2,ip3,ip4<space>) # NOTE - Syntax with parenthesis and <space> is very important.
Note:- Create an SSH key pair on the deployment host. This is used for secure communication with the four-VMs cluster. Leave the passphrase empty when creating the key. Ensure the public key has aleast 100 characters. Following is the sample of ssh key generation command.
ssh-keygen -t rsa
- The first IP address mentioned in the IPS list is used as the ControlNode VM. For example, ip1 is the ControlNode IP. The ClusterIP and ControlNodeIP are the same for Native Kubernetes VM-based VMware Telco Cloud Service Assurance deployment.
- Create an SSH key pair on the deployment host. This is used for secure communication with the four-VMs cluster. Leave the passphrase empty when creating the key. Ensure the public key has aleast 100 characters. Following is the sample of ssh key generation command.
- Launch Kubernetes installation.
$./install-kubernetes.sh
The script installs K8s on four nodes with 1 control plane node and 3 worker nodes. Progress is displayed on the terminal and saved in ansible.log file.
- After the Kubernetes installation is complete, ensure that you get the following message Kubernetes installation complete. Proceed to application deployment as documented.
-
kubeconfig
file is under .kube directory and can be used to verify other details of the cluster.export KUBECONFIG=<path to kubeconfig under .kube>