References

Installation and setup of Kubernetes cluster using Ansible

Pre-requisites

  1. If you do not have an Ansible setup. Please setup by following the instructions here
  2. One or more VMs reachable from where Ansible playbooks are being run

Note

Ansible playbooks referred in the below steps are located in devops-at-scale/devops-at-scale/ansible-playbooks/k8s_setup

Usage

  1. Download roles

    ansible-galaxy install --roles-path roles -c geerlingguy.docker
    ansible-galaxy install --roles-path roles -c geerlingguy.kubernetes
    
  2. Create inventory file

    $ cat inventory
    [all]
    scspa0633050001 kubernetes_role="master"
    scspa0633051001 kubernetes_role="node"
    

If more than one node, tag them appropriately.

  1. Install docker and kubernetes

    ansible-playbook -i inventory -K --become-method=su --become k8s_setup_cluster.yml
    

This will install kudeadm, kubelet, kubectl, and create a cluster with worker nodes.

Installation and setup of Trident on Kubernetes using Ansible

Pre-requisites

  1. If you do not have an Ansible setup. Please setup by following the instructions from Ansible Setup
  2. Kubernetes cluster. The inventory file identifies master and worker nodes.
  3. ONTAP cluster

Note

Ansible playbooks referred in the below steps are located in devops-at-scale/devops-at-scale/ansible-playbooks/trident_setup

Qualify your Kubernetes cluster

ansible-playbook -i inventory kubectl_check.yml -K --become --become-method=su --extra-vars=@vsim_vars.yml
(requires root access on K8S master node to run kubectl)

Preparation

  1. The trident_prereqs.yml playbook will install pip, setuptool, and the openshift python package. This is required to run k8s Ansible module.

This playbook will then create a “trident” namespace.

ansible-playbook -i inventory trident_prereqs.yml -K --become --become-method=su

Download installer and final checks

  1. The trident.yml playbook will install the trident installer and set up a backend storage file to support trident etcd database:

    ansible-playbook -i inventory trident.yml -K --become --become-method=su --extra-vars=@vsim_vars.yml
    

(requires root access on K8S master node to run yum - and maybe k8s)

Trident installation

3. The next step will be to run the trident installer. In the kubernetes master node:

  1. Check Trident is running

    ansible-playbook -i inventory trident_check_pods.yml -K --become --become-method=su
    

As of today, you should see: 2/2 Running (1 pod is running 2 containers out of 2)

Trident configuration

5. The backend created in the preparation step is only used to support the Trident etcd persistent storage. New backend(s) need to be created to support production.

Add backend

Being lazy here, we can reuse the same backend

trident/trident-installer/tridentctl -n trident create backend -f trident/trident-installer/setup/backend.json

6. Add storage class in Kubernetes. Follow instructions Trident documentation

7. Test Trident installation by creating first volume and mounting it into an nginx pod. Follow instructions Trident example