Forked from csiens/Rancher Kubernetes Engine with TungstenFabric on Ubuntu.txt
Created
January 19, 2020 10:22
-
-
Save arashkaffamanesh/7bd5d4fd4e47bcbe3c632690fb79b33f to your computer and use it in GitHub Desktop.
Rancher Kubernetes Engine with TungstenFabric on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Install Ubuntu on nodes and set hostname and IP on all nodes | |
2) Prepare nodes. Run these commands as the root user on all nodes | |
#turn off swap | |
swapoff -a | |
#install packages | |
apt-get install -y ntp docker.io | |
#configure ntp. set pool.ntp.org to your local or preferred server | |
sed -i '/pool/d' /etc/ntp.conf | |
echo 'server pool.ntp.org iburst' | tee -a /etc/ntp.conf | |
service ntp restart | |
#disable firewall | |
sudo ufw disable | |
3) Distribute ssh keys | |
#copy existing ssh key pair to /root/.ssh/ on the master node or create a new ssh key pair with | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
#distribute the public key to each node with | |
ssh-copy-id user@node | |
4) Instantiate RKE Kubernetes cluster with no CNI plugin | |
#run these commands as root on the master node | |
#cd and download rke binary | |
cd /root/ ; wget https://github.com/rancher/rke/releases/download/v0.3.0/rke_linux-amd64 | |
#rename, chmod, move, test rke binary | |
mv rke_linux-amd64 rke ; chmod +x rke ; mv rke /usr/bin ; rke --version | |
#configure the cluster.yml using 'rke config'. | |
#set the following variables for each node and accept the default for all other variables | |
rke config | |
#Number of Hosts #enter the number of nodes in the cluster | |
#SSH Address of Hosts #enter IP address for node | |
#SSH User of host #enter root | |
#Is host a Control Plane host #enter y for master node | |
#Is host a Worker Host #enter y for worker node | |
#Is host an etcd host #enter y for master node | |
#Override Hostname of host #enter hostname of node | |
#Network Plugin type #enter none | |
#Service Cluster IP Range #enter 10.96.0.0/12 | |
#Cluster Network CIDR #enter 10.32.0.0/12 | |
#Cluster DNS Service IP #enter 10.96.0.3 | |
#run rke up to instantiate rke kubernetes cluster | |
rke up | |
5) Install TungstenFabric | |
#run these commands as root on the master node | |
#install kubectl | |
sudo snap install kubectl --classic | |
#copy kubeconfig into place | |
mkdir /root/.kube ; cp /root/kube_config_cluster.yml /root/.kube/config | |
#label master nodes with the 'node-role.kubernetes.io/master=true' label. | |
#replace <MASTER_NODE_NAME> with the hostname of the master node | |
kubectl label nodes <MASTER_NODE_NAME> node-role.kubernetes.io/master=true | |
#add /var/lib/contrail/ports/vm to rke kubelet container ON ALL NODES | |
docker exec -it kubelet mkdir -p /var/lib/contrail/ports/vm | |
#install TungstenFabric via manifest. set <MASTER_NODE_IP> to the master node ip | |
export K8S_MASTER_IP=<MASTER_NODE_IP> ; CONTRAIL_REPO="docker.io\/opencontrailnightly"; CONTRAIL_RELEASE="latest"; mkdir -pm 777 /var/lib/contrail/kafka-logs; curl https://raw.githubusercontent.com/Juniper/contrail-kubernetes-docs/master/install/kubernetes/templates/contrail-single-step-cni-install-ubuntu.yaml | sed "s/{{ K8S_MASTER_IP }}/$K8S_MASTER_IP/g; s/{{ CONTRAIL_REPO }}/$CONTRAIL_REPO/g; s/{{ CONTRAIL_RELEASE }}/$CONTRAIL_RELEASE/g" >> /root/tf.yml ; kubectl apply -f /root/tf.yml | |
#fix coredns | |
kubectl get configmap -nkube-system coredns -o yaml >> /root/coredns-configmap.yaml | |
export coredns_line=" forward . 10.47.255.253" | |
sed -i "s/.*forward.*/$coredns_line/" /root/coredns-configmap.yaml | |
kubectl get deployment -nkube-system coredns -o yaml >> /root/coredns-deployment.yaml | |
sed -i "/ livenessProbe:/,+9d" /root/coredns-deployment.yaml | |
sed -i "/ readinessProbe:/,+8d" /root/coredns-deployment.yaml | |
kubectl apply -f /root/coredns-configmap.yaml | |
kubectl apply -f /root/coredns-deployment.yaml | |
#get pod status | |
kubectl get pods --all-namespaces -owide | |
#for now it is safe to ignore analytics db crashloop | |
#kube-system contrail-analyticsdb-r6474 2/3 CrashLoopBackOff | |
#get TungstenFabric status once all TungstenFabric pods are running | |
contrail-status | |
login to webui at https://<MASTER_NODE_IP>:8143 u: admin p: contrail123 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment