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.
Ansible Playbook to Deploy VS
- hosts: localhost connection: local roles: - role: avinetworks.avisdk tasks: - name: Create a Pool avi_pool: controller: 10.10.26.40 username: admin password: Admin@123 name: test_aman description: test state: present health_monitor_refs: - '/api/healthmonitor?name=System-HTTP' servers: - ip: addr: 10.91.1.53 type: V4 - name: Create a VS avi_virtualservice: controller: 10.10.26.40 username: admin password: Admin@123 name: testvs_aman description: testvs state: present api_version: 17.2.7 pool_ref: "/api/pool?name=test_aman" vip: - ip_address: addr: '10.91.0.6' type: 'V4' services: - port: 80
ansible-playbook -v test2.yml --step
- References
{{#widget:DISQUS
|id=networkm
|uniqid=AVI
|url=https://aman.awiki.org/wiki/AVI
}}