Skip to content

Setting Up Instances, Kubernetes Cluster, Jenkins

Kaustubh Bhalerao edited this page Mar 21, 2020 · 6 revisions

Using OpenStack Horizon For Creating 4 Instances:

Citing: https://iujetstream.atlassian.net/wiki/spaces/JWT/pages/44826638/Using+the+OpenStack+Horizon+GUI+Interface

Instance 1: DevengersJenkins(Jenkins Master) Instance 2: (Kubernetes-Master) Instance 3: (Kubernetes-Worker1) Instance 4: (Kubernetes-Worker2)

All the 4 instances are created using following steps:

  1. Set the Allocation : TG-CCR180043
  2. Click on the Project -> Compute -> Instances -> Launch Instance
  3. [Details]Select Instance Name -> As per your choice, Description -(Instance Functionality Description), Availability Zone-(Check Any), Count (Check -> 1) -> click on Next
  4. [Source] Select Boot Source -> Image -> Select 'JS-API-Featured-Ubuntu18-Feb-14-2020' '8.00 GB' Image. Click on next
  5. [Flavor] Select m1.quad for Kubernetes(master and slave node) Else Select m1.medium for Jenkins.
  6. [Networks] Select Devengers_net, Click on next
  7. [Network Ports] Skip Click on next
  8. [Security Groups] Select Devengers_security_group, click on next
  9. [Key Pair] Select key as Devengers, Click on Launch Instance
  10. Once the Instance is created -> On the extreme right side you will see Actions tab, Under that select dropdown from "Create Snapshot" -> Associate a Floating IP. Select a Floating IP that's available. Note the floating IP for every instance as you will need this to ssh the instance.

Installing Ansible on Ubuntu (Local Machine)

Citing:https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-18-04#step-1-%E2%80%94-installing-ansible

  1. sudo apt-add-repository ppa:ansible/ansible
  2. sudo apt update
  3. sudo apt install ansible
  4. Then do, sudo vi /etc/ansible/hosts, paste the below content: [servers]
    <master_alias> ansible_host=<master_ip>
    <slave1_alias> ansible_host=<slave_ip>
    <slave2_alias>ansible_host=<slave_ip>
    [servers:vars]
    ansible_python_interpreter=/usr/bin/python3

Creating Kubernetes Cluster Using Kubeadm on Ubuntu 18.04

Citing: https://www.digitalocean.com/community/tutorials/how-to-create-a-kubernetes-cluster-using-kubeadm-on-ubuntu-18-04

Once the ansible is installed using above step, then proceed with Kubernetes Cluster installation guidelines:

  1. Clone the github -> Go to the folder :- cd kube-cluster (Citing: https://iu.instructure.com/courses/1857048/discussion_topics/9220186).
  2. Open the file named hosts(nano hosts) and enter your Kubernetes Master and Slave IP's.
  3. Open the initial.yml nano (initial.yml) make sure the key name is right and key has permission 400.(if not use command "chmod 400 id_rsa"). You could get the key from the repo.
    -> Run the command ansible-playbook -i hosts ~/kube-cluster/initial.yml
  4. Don't change anything inside kube-dependencies.yml -> Run the ansible-playbook -i hosts kube-dependencies.yml
  5. Don't change anything inside master.yml -> Run the ansible-playbook -i hosts master.yml
  6. Don't change anything inside worker.yml -> Run the ansible-playbook -i hosts worker.yml
  7. Finally, Verify the cluster ssh ubuntu@Kubernetes_master_ip
  8. Get the status of the cluster -> kubectl get nodes
Clone this wiki locally