Assignment 2 : Getting started - airavata-courses/NSA GitHub Wiki

To create VMs on Jetstream

  • Login to Horizon:

  • Create a network

    • Click on Project/Network/Network Topology/Create Network
    • Enter a network name and a subnet name in order to create a network.
    • Use Create Router to create a router
    • Make sure that the router is public under the External Network dropdown.
    • Click Add Interface.
    • Create a key pair.
    • Download the .pem file.
  • Create an instance

    • Using create instance
    • Select a JS-API Ubuntu Image
    • Select m2.medium flavor machine with 16 GB of RAM
    • Attach it to the network that you created in the previous steps.
  • Allocate a public floating IP address to the instance from the pool of your network.

  • Login in to your instance using the following command: ssh -i <path_to_file>.pem ubuntu@<floating_ip>

To create Kubernetes cluster:

  • Download the scripts from kubernetes_cluster branch.
  • Note you will need atleast 2 slave nodes and 1 master node to execute the following scripts. All the nodes should have Ubuntu 18.04 with at least 2GB RAM and 2 vCPUs each.
  • Install ansible: sudo apt install ansible Verify ansible is successfully installed: ansible --version -In the downloaded folder, edit the hosts file and add the IPs of master and slave nodes as following:
   master ansible_host=master_ip ansible_user=root

   [workers]
   worker1 ansible_host=worker_1_ip ansible_user=root
   worker2 ansible_host=worker_2_ip ansible_user=root

   [all:vars]
   ansible_python_interpreter=/usr/bin/python3
  • Perform all the following steps from the within the folder downloaded above.
  • Create a Non-Root User on All Remote Nodes by running the following command:
    • ansible-playbook -i hosts initial.yml
  • Install Kubernetes dependencies by executing the following command:
    • ansible-playbook -i hosts kube-dependencies.yml
  • Set up the master node by executing the following command:
    • ansible-playbook -i hosts master.yml
    • To check if the script worked successfully, ssh into the master using the following command: ssh ubuntu@master_ip
    • And then execute kubectl get nodes. You should get the following output if the above script ran successfully
      NAME      STATUS    ROLES     AGE       VERSION
      master    Ready     master    1d        v1.14.0
      
  • Set up worker nodes by executing the following command:
    • ansible-playbook -i hosts worker.yml
  • To verify if your cluster is successfully set up, execute the following command:
    • ssh ubuntu@master_ip Then execute
    • kubectl get nodes
      NAME      STATUS    ROLES     AGE       VERSION
      master    Ready     master    1d        v1.14.0
      worker1   Ready     <none>    1d        v1.14.0
      worker2   Ready     <none>    1d        v1.14.0
      
⚠️ **GitHub.com Fallback** ⚠️