AVI

= Kubernetes Integration= Source: avinetworks.com

Create a Service Account kubectl create serviceaccount avi -n default

Create a Cluster Role for deploying Avi Service Engines as a pod:

nano clusterrole.json {   "apiVersion": "rbac.authorization.k8s.io/v1beta1", "kind": "ClusterRole", "metadata": { "name": "avirole" },   "rules": [ {           "apiGroups": [ ""           ],            "resources": [ "*"           ],            "verbs": [ "get", "list", "watch" ]       },        {            "apiGroups": [ ""           ],            "resources": [ "pods", "replicationcontrollers" ],           "verbs": [ "get", "list", "watch", "create", "delete", "update" ]       },        {            "apiGroups": [ ""           ],            "resources": [ "secrets" ],           "verbs": [ "get", "list", "watch", "create", "delete", "update" ]       },        {            "apiGroups": [ "extensions" ],           "resources": [ "daemonsets", "ingresses" ],           "verbs": [ "create", "delete", "get", "list", "update", "watch" ]       }    ] }

kubectl create -f clusterrole.json

Create Cluster Role Binding nano clusterbinding.json {   "apiVersion": "rbac.authorization.k8s.io/v1beta1", "kind": "ClusterRoleBinding", "metadata": { "name": "avirolebinding", "namespace": "default" },   "roleRef": { "apiGroup": "rbac.authorization.k8s.io", "kind": "ClusterRole", "name": "avirole" },   "subjects": [ {           "kind": "ServiceAccount", "name": "avi", "namespace": "default" }   ] }

kubectl create -f clusterbinding.json

Extract the Token for Use in Avi Cloud Configuration kubectl describe serviceaccount avi -n default kubectl describe secret avi-token-esdf0 -n default

On AVI Controller
Enter the Master IP address & Token in AVI Portal: https://10.1.10.160:6443

Create NorthSouth-IPAM NorthSouth_DNS

EastWest-IPAM EastWest-DNS

Goto Tenant Default, Check VS status

Either Disable Kube-Proxy(which is default LB in Kubernetes) or Give it a different IP than East_West Subnet.

= OpenShift =

= Using Ansible =

mkdir ~/virtualenv mkdir avisdk mkdir bin

cd ~/virtualenv/ cd avisdk/

pip install setuptools

export LC_ALL=C virtualenv ~/virtualenv/avisdk/ pip install avisdk

cd bin . activate

pip install avisdk==17.2.7b2 pip install avisdk pip freeze

cd ~/virtualenv/avisdk/ cd bin source activate pip install ansible cp /tmp/for_ansible_training.yml ~ nano ~/for_ansible_training.yml ansible-playbook ~/for_ansible_training.yml ansible-playbook ~/for_ansible_training.yml -vvvvv

ansible-galaxy -f install avinetworks.avisdk la ~/.ansible/roles/avinetworks.avisdk/library/

ansible-playbook ~/for_ansible_training.yml

= Ansible Playbook to Deploy VS =

nano avi-deploy.yml

Available Roles: ls /etc/ansible/roles/avinetworks.avisdk/library/

Deployment: ansible-playbook -v avi-deploy.yml --step

= Using AVI SDK =

nano pool_vs.py

python pool_vs.py -u admin -p Admin@123 -c 10.10.26.40 -t admin -vs test_aman -v 10.91.0.6 -po test_pool_aman


 * References