Skip to content

Installing Rancher Step 1

GowthamCh edited this page Apr 29, 2022 · 7 revisions

Note:

(Update Apr:28th) There are issues with the communication between the workers when we are creating this setup. I have added a new document that can setup Kubernetes without using Rancher. (Link)

Rancher Setup:

Login to the instance where you were assigned a public domain. (public domain of the VM)

1. Setting up SSH:

Copy the public key from your local machine to authorized keys in your remote machine.

To find the public key of your machine type in the below command
cat ~/.ssh/id_rsa.pub
Paste the content to the authorized keys file on your remote. (Run this on your remote machine)
vi ~/.ssh/authorized_keys
<paste the public key>

2. Configuring cloudmon

  • Download and extract the modified cloudmon code from this file: (Provided by Isuru)
https://airavata.slack.com/files/U030JR7JXDF/F03CA28HZ6J/cloudman.zip

Modify the sample.ini file present in the Inventory/sample.ini

  • Update the agent to your domain name.
  • Update the controllers to your domain name.
  • Update ansible user to exouser. (If instance is created from Exosphere)
  • Update ansible password to passphrase.
  • Uncomment the last line and put the path to your public key.

Below is the file we had after updating all the details.

[controllers]
js2-154-102.jetstream-cloud.org

[agents]
js2-154-102.jetstream-cloud.org

[rke_cluster:children]
controllers
agents

[all:vars]
ansible_ssh_port=22
ansible_user='exouser'
ansible_user_password='LUKE AWN CRAM SHOE GIRL BOOT HERO EVIL OWLY WOK YEAH'
ansible_ssh_extra_args='-o StrictHostKeyChecking=no'
ansible_ssh_private_key_file=/Users/chowtagowtham/.ssh/id_rsa

3. Open a terminal in the cloudman-boot folder. Create a virtual environment and activate it.

python -m venv cust-dev
source cust-dev/bin/activate
pip install ansible

And run the ansible playbook.

ansible-playbook -i inventory/sample.ini  playbook.yml  

This should take a good 5-10 mins to set everything. It is time to take a coffee break.

  • This will setup Helm, Rancher, cloudmon. It also setups Kubernetes secrets, certificate setup. You should get the output something similar to this:
image

4. Setting up rancher

  • Login to the Jetstream VM. Run the below commands
helm repo add rancher https://releases.rancher.com/server-charts/stable
kubectl create namespace cattle-system
helm repo update

And finally:

## Replace the hostname with your hostname, email with your email.
helm install -n cattle-system rancher rancher/rancher --set hostname=<HOSTNAME> --set ingress.tls.source=letsEncrypt --set letsEncrypt.email="<email_add> --set letsEncrypt.environment="production" --set letsEncrypt.ingress.class=nginx --version 2.5.5

## Here is the command I will be running. Please change accordingly. 
helm install -n cattle-system rancher rancher/rancher --set hostname=js2-154-102.jetstream-cloud.org --set ingress.tls.source=letsEncrypt --set letsEncrypt.email="chgowt@iu.edu" --set letsEncrypt.environment="production" --set letsEncrypt.ingress.class=nginx --version 2.5.5

You should get the below output:
image

Wait for a couple of mins for the cluster to be started.

4.2 Checking if everything is setup. After you run the below command you should see everything in running and completed state.

kubectl get all --all-namespaces

4.3 Accessing the rancher from the browser:

After type in below command you should see inginx-ngress-controller with a type Load balancer. Get the node ports starting >30000.

kubectl get services  -n ingress-nginx

Try to access the URL https://your-domain-name:nodeport

Known issue

There is a good chance that you get a certificate error when you try to access the URL. One fix is to install ingress-nginx-controller again.

Run the below commands to remove ingress-nginx.

 helm delete ingress-nginx -n ingress-nginx
## Wait till all the resources of ingress-nginx are deleted. You can continuously ping with the below command to check if there are any resources available. 
kubectl get all -n ingress-nginx

And run the below command to install ingress-nginx

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml
## Wait till all the services are up of ingress-nginx. You can continuously check using the same command. 
kubectl get all -n ingress-nginx

Now again find the node port using the above command. The node port might change since we re-installed the nginx-ingress service. image

Try to access the URL again https://domainname:nodeport

Our rancher is live on: https://js2-154-102.jetstream-cloud.org:32573/

Updated IP: (https://custosterrarancher.org:30747/). We lost the old domain, we repeated the same steps on a different domain name.

  • Lastly, Create password and you are ready to setup kubernetes cluster.
    Note: The username will be 'admin'.

We would like to thank Isuru and Abhinav for their support through out the setup.

Clone this wiki locally