Installing Red Hat OpenShift Container Platform with Contrail Networking
Perform the following steps to install Red Hat OpenShift Container Platform with Juniper Networks Contrail Networking.
Installing Red Hat OpenShift Container Platform
To install Red Hat OpenShift Container Platform.
- Install CentOS 7.3 minimal distribution on both master and slave nodes.
- Download the Contrail-Ansible package and the Contrail-Kubernetes-Docker-Images package from Juniper’s download site and copy them to the master node. You must create an account to download the packages.
- Install the Extra Packages for Enterprise Linux (EPEL)
on the master and slave nodes.
(all-nodes)# yum install git epel-release vim NetworkManager –y (all-nodes)# yum update -y
- Install all dependencies, set SELinux to “enforcing”,
and reboot the nodes.
(master)# yum install kernel-devel kernel-headers –y (master)# yum install ansible pyOpenSSL python-cryptography python-lxml -y (slave)# yum install kernel-devel kernel-headers nfs-utils socat -y (all-nodes)# vi /etc/sysconfig/selinux SELINUX=enforcing (all-nodes)# reboot
- Enable password-free SSH access to all nodes from the
master node and verify that you can log in without a password.
(master)# ssh-keygen –t rsa (master)# ssh-copy-id <root@<master-node-ip> (master)# ssh-copy-id <root@<slave-node-ip>
- Add hostnames of all nodes to the
/etc/hostsfile and verify that you can resolve the hostnames to IP addresses.(all-nodes)# cat /etc/hosts 192.0.2.0 5b4s40.device.example.net 5b4s40 #master-node 192.0.2.1 5b4s41.device.example.net 5b4s41 #slave-node (master)# ping <slave-hostname>
- Clone the OpenShift Ansible project-repo.
(master)# git clone https://github.com/openshift/openshift-ansible (master)# cd openshift-ansible
- Populate the files ose-prerequisites and ose-install.
(master)# vi /root/openshift-ansible/inventory/byo/ose-prerequisites.yml (master)# vi /root/openshift-ansible/inventory/byo/ose-install
For more information, see ose-prerequisites.yml and ose-install.
- Run the ansible-playbook which will install the prerequisites
on the nodes and install the atomic-openshift packages that you downloaded.
(master)# ansible-playbook -i inventory/byo/ose-install inventory/byo/ose-prerequisites.yml
- Run the ansible-playbook to install OpenShift.
(master)# ansible-playbook -i inventory/byo/ose-install playbooks/byo/openshift_facts.yml (master)# ansible-playbook -i inventory/byo/ose-install playbooks/byo/config.yml
Installing Contrail Networking for Red Hat OpenShift
Use this procedure to install Contrail Networking for RedHat OpenShift.
- Clone the contrail-ansible project repo.
(master)# mkdir contrail-ansible && cd contrail-ansible (master)# tar -xvzf contrail-ansible*.tar.gz (master)# mkdir playbooks/container_images && cd playbooks/container_images
- Untar the contrail-kubernetes-docker-images package.
(master)# tar -xvzf contrail-kubernetes-docker-images_4.0.0.0-20.tgz
- Populate the
inventory/hostsfile.(master)# vi /root/contrail-ansible/playbooks/inventory/my-inventory/hosts
For more information, see hosts.
- Populate the YAML file with configuration parameters specific
to your system.
(master)# vi /root/contrail-ansible/playbooks/inventory/my-inventory/group_vars/all.yml
For more information, see all.yml.
- Run the Ansible playbook to install Contrail Networking.
(master)# ansible-playbook -i inventory/my-inventory site.yml
Initializing Red Hat OpenShift Container and Contrail Networking
Use this procedure to io initialize Red Hat OpenShift Container and Contrail Networking.
- Create a new project and move into the project context.
(master)# oc login -u system:admin (master)# oc new-project juniper (master)# oc project juniper
- Create a service account to access the APIs.
(master)# oc create serviceaccount useroot
- Bind the service account to the role.
(master)# oadm policy add-cluster-role-to-user cluster-reader \ system:serviceaccount:juniper:useroot
- Add the user to a privileged security context constraint.
(master)# oadm policy add-scc-to-user privileged system:serviceaccount:juniper:useroot
- Assign the cluster-admin role to the admin user.
(master)# oadm policy add-cluster-role-to-user cluster-admin admin
- Assign a token to a service account.
(master)# oc serviceaccounts get-token useroot
- Copy the service account token and log in to the contrail-kube-manager
container.
(master)# docker ps (master)# docker exec -it contrail-kube-manager bash
- Add the token to the
contrail-kubernetes.conffile.(contrail-kube-manager)# vi /etc/contrail/contrail-kubernetes.conf [VNC] … token = serviceaccount-token
For more information, see contrail-kubernetes.conf.
- Ensure that the cluster_project dict is empty.
(contrail-kube-manager)# vi /etc/contrail/contrail-kubernetes.conf cluster_project = {} - Restart the contrail-kube-manager service.
(contrail-kube-manager)# supervisorctl -s unix:///var/run/supervisord_kubernetes.sock supervisor> restart all supervisor> status supervisor> exit
- Log in to the slave node and move the OpenShift Container
Network Interface (CNI) to a different location.
(slave)# cd /etc/cni/net.d (slave)# mv 80-openshift-sdn.conf /etc/
- Log in to the respective Web-UI dashboards.
- Create a password for the admin user to log in to the
UI and assign permissions.
(master)# htpasswd /etc/origin/master/htpasswd admin (master)# oc login -u admin
- Log in to Contrail Web-UI.
OpenShift Web-UI: https://<master-node-IP>:8443 Contrail Web-UI: https://<master-node-IP>:8143
- Enable Images to Run with USER in the Docker file and
edit the restricted SCC.
(master)# oc edit scc restricted
- Change the runAsUser.Type strategy to RunAsAny.
runAsUser: type: RunAsAny
- Set up BGP peering with the gateway router.
Configure > Infrastructure > BGP Routers
- Set up a network IPAM under the “default”
project.
Configure > Networking > IP Address Management > default-domain > default
- Create a public virtual network.
Configure > Networking > Networks > default-domain > default
- Create a password for the admin user to log in to the
UI and assign permissions.

