Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Installing and Provisioning Containerized Contrail Controller for Kubernetes

This section describes the steps required to install and provision containerized Contrail Controller for Kubernetes.

Ensure the following prerequisites are met for successful provisioning of a Contrail Kubernetes cluster.

  • An installed and running Kubernetes cluster is available.

    You can choose the installation method for Kubernetes.

  • Kubernetes cluster must have at least one worker node.

    The Kubernetes cluster consists of one master node and at least one worker node. Kubernetes “tainted” master, a mode in which worker pods are scheduled on Kubernetes master node, is not supported.

  • Ensure that Kubelet running on the Kubernetes master node does not have network plugin options.

    If Kubelet is configured with a network plugin option:

    1. Disable or comment out the KUBELET_NETWORK_ARGS option in the configuration file.

      /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

    2. Restart the Kubelet service.

      systemctl daemon-reload; systemctl restart kubelet.service

  • Get a service account token that has a cluster-admin cluster role.

    You can configure this token in contrail-ansible during provisioning of the Contrail Kubernetes cluster.

    For more information, refer to the kubernetes_access_token variable in the all.yml in contrail-ansible.

    1. Create a service account and bind it to the cluster-admin cluster role.

      kubectl create clusterrolebinding <role-binding-name> --clusterrole=cluster-admin --serviceaccount=<service-account-name>

      Alternatively, you can bind the cluster-admin role to an existing service account.

      Example: Bind a cluster-admin role to a service account named default.

      kubectl create clusterrolebinding contrail-kube-manager --clusterrole=cluster-admin --serviceaccount=default:default

    2. Get the secret associated with the service account.

      kubectl describe sa <service-account-name>

      Example:

    3. Get the token associated with the secret.

      kubectl describe secret <name>

      Example:

Installing and Provisioning Containerized Contrail Controller for Kubernetes

Perform the following steps to install containerized Contrail controller for Kubernetes:

  1. Set up password-free access to all hosts from Ansible host.

    Ensure ssh <user>@<host-ip> works fine.

  2. Install Ansible on your Mac OS X or any other machine. Version must be = 2.2.0.

  3. Download contrail-kubernetes-docker_<release>_<os-name>.tgz package and extract it. The extracted package contains contrail-networking-tools_<release>.tgz and contrail-kubernetes-docker-images_<release>.tgz packages.

    The contrail-networking-tools_<release>.tgz contains the contrail-ansible package while the contrail-kubernetes-docker-images_<release>.tgz contains Contrail container images.

  4. Extract the contrail-ansible package from the contrail-networking-tools_<release>.tgz package.

    contrail-ansible is used to provision a Contrail Kubernetes cluster. The contrail-ansible repo contains a site.yml playbook that has the requisite roles and tasks to provision a fully-functional Contrail Kubernetes cluster. The inventory files in the repo expose all the parameters required by the playbook to provision the cluster. The contrail-ansible directory-based inventory file mechanism is recommended for provisioning.

    Note:

    The scope of contrail-ansible is to provision only the Contrail part of the Kubernetes solution. The Kubernetes cluster should be provisioned independently using recommended Kubernetes guidelines.

    Contrail Kubernetes clusters can be provisioned in the following modes:

    • Stand-alone Contrail Kubernetes cluster

      In this mode, Contrail provides networking to a stand-alone Kubernetes cluster. Contrail components are provisioned and dedicated to the management of this cluster.

    • Nested Contrail Kubernetes cluster

      In this mode, Contrail provides networking for a Kubernetes cluster that is provisioned on a Contrail OpenStack cluster. Contrail components are shared between the two clusters. Ansible provisions only the Contrail components that directly interface with the Kubernetes API server. All other Contrail components are shared between OpenStack and Kubernetes clusters.

  5. Create a folder called container_images inside contrail-ansible/playbook. Copy container images to this folder by extracting contrail-kubernetes-docker-images_<release>.tgz.

  6. Update the inventory file.

    The inventory files in directory-based provisioning are as following:

  7. Run the Ansible playbook from contrail-ansible/playbook.

inventory/my-inventory/hosts Inventory File

This section describes the parameters and provides examples of the inventory/my-inventory/hosts inventory file in stand-alone and nested Contrail Kubernetes clusters.

Table 1 lists the parameters used in the inventory/my-inventory/hosts inventory file.

In Table 1, Cluster Mode is one of the following:

  • Stand-alone —Applicable only to a stand-alone cluster.

  • Nested —Applicable only to nested cluster.

  • Both—Applicable to both stand-alone and nested clusters.

Table 1: Parameters in inventory/my-inventory/hosts

Parameter

Cluster Mode

Description

contrail-repo

Nested

List of hosts where contrail apt or yum repo container will be started. This repo will be used by other nodes on installing any packages in the node. Setting up contrail-cni needs this repo enabled

contrail-controllers

Stand-alone

List of hosts where contrail-controller container or processes are to be provisioned. .

contrail-analyticsdb

Stand-alone

List of hosts where contrail-analyticsdb container or process is to be provisioned.

contrail-analytics

Stand-alone

List of hosts where contrail-analytics container or process is to be provisioned.

contrail-kubernetes

Both

Node where contrail-kube-manager container or process is to be run.

contrail-compute

Both

List of hosts which are to be provisioned as kubernetes compute/minion nodes. Contrail vRouter or vrouter-agent or CNI will be provisioned on these nodes.

kubernetes-contrail-controllers

Nested

List of nodes with pre-existing contrail-controller container or processes to which contrail-kube-manager should connect to.

kubernetes-contrail-analytics

Nested

List of nodes with pre-existing contrail-analytics container or processes to which contrail-kube-manager should connect to.

Example: inventory/my-inventory/hosts File in a Stand-alone Contrail Kubernetes Cluster

The following is an example of the inventory/my-inventory/hosts file in a stand-alone Contrail Kubernetes cluster:

Example: Nested inventory/my-inventory/hosts File in a Nested Contrail Kubernetes Cluster

The following is an example of the inventory/my-inventory/hosts file in a nested Contrail Kubernetes cluster:

inventory/my-inventory/group_vars/all.yml Inventory File

This section describes the parameters and provides examples of the inventory/my-inventory/group_vars/all.yml inventory file in stand-alone and nested Contrail Kubernetes clusters.

Table 2 describes the configuration parameters used in the inventory/my-inventory/group_vars/all.yml inventory file.

In Table 2, Cluster Mode is one of the following:

  • Stand-alone —Applicable only to a stand-alone cluster.

  • Nested —Applicable only to nested cluster.

  • Both—Applicable to both stand-alone and nested clusters.

Table 2: Parameters in inventory/my-inventory/group_vars/all.yml
Parameter Value Default Cluster Mode Description

cloud_orchestrator

Kubernetes

None

Both

Specifies orchestrator type.

contrail_compute_mode

container

bare_metal

Both

Specifies if the Contrail components must be run as containers or as processes on a stand-alone server.

keystone_config

{ip: <ip>, admin_password: <passwd>, admin_user: <username>, admin_tenant: <tenant-name>}

None

Nested

Keystone authentication information.

nested_cluster_private_network

"<cluster-private-CIDR>"

None

Nested

The IP subnet reserved for use by Kubernetes for internal cluster management and housekeeping. The Ansible user is responsible to make sure this CIDR does not collide with existing CIDRs in the virtual-network.

kubernetes_cluster_name

<cluster-name>

k8s-default

Both

Name of the Kubernetes cluster being provisioned.

nested_cluster_network

{domain: <name>, project: <name>, name: <name>}

None

Nested

Virtual Network in which the Kubernetes cluster must be provisioned. This network must be the same network to which the virtual machines that host the Kubernetes cluster belong.

kubernetes_access_token

< token >

None

Both

RBAC token to connect to Kubernetes API server.

nested_mode

true

None

Nested

Parameter to enable nested provisioning of a Kubernetes cluster.

kubernetes_public_fip_pool

{domain: <id>, project: <id>, network: <id>, name: <id>}

None

Both

Kubernetes FloatingIpPool to be used for service or ingress.

kubernetes_cluster_project

{domain: <id>, project: <id>}

{domain: default-domain, project: default}

Both

Fq-name of Contrail project within which Kubernetes cluster must be provisioned.

kubernetes_pod_subnet

<CIDR>

10.32.0.0/12

Both

Pod subnet used by Kubernetes cluster.

kubernetes_service_subnet

<CIDR>

10.96.0.0/12

Both

Service subnet used by Kubernetes cluster.

kubernetes_api_server

<IP>

Contrail Control Node IP

Both

Node on which kubernetes-api server is running.

Example: inventory/my-inventory/group_vars/all.yml File in a Stand-alone Contrail Kubernetes Cluster

The following is an example of the inventory/my-inventory/group_vars/all.yml file in a stand-alone Contrail Kubernetes cluster:

Example: inventory/my-inventory/group_vars/all.yml File in a Nested Contrail Kubernetes Cluster

The following is an example of the inventory/my-inventory/group_vars/all.yml file in a nested Contrail Kubernetes cluster