Avi Infra Setting provides a way to segregate Layer-4/Layer-7 virtual services to have properties based on different underlying infrastructure components, like Service Engine Group, intended VIP Network etc.
Here I have a different network that I want a new Ingress to use, in this case the tkg-wkld-trf-vip network, 172.16.4.97/27, lets assume its used for 5G traffic connectivity and the NSX-T T1 is connected to a different T0 VRF. This isolates the traffic between VRFs, so that we can expose certain applications on different VRFs.
In this example, I’ll change Grafana from using the default VIP network to the tkg-wkld-trf-vip network instead. You can read up on how this was originally done using the default VIP network in the previous post.
aviinfrasetting-tkg-wkld-trf-vip.yaml
---
apiVersion: ako.vmware.com/v1alpha1
kind: AviInfraSetting
metadata:
name: aviinfrasetting-tkg-wkld-trf-vip
spec:
seGroup:
name: tkg-workload1
network:
vipNetworks:
- networkName: tkg-wkld-trf-vip
cidr: 172.16.4.96/27
enableRhi: false
Attaching Avi Infra Setting to Ingress
Avi Infra Settings can be applied to Ingress resources, using the IngressClass
construct. IngressClass
provides a way to configure Controller-specific load balancing parameters and applies these configurations to a set of Ingress objects. AKO supports listening to IngressClass
resources in Kubernetes version 1.19+. The Avi Infra Setting reference can be provided in the Ingress Class
as shown below:
aviingressclass-tkg-wkld-trf-vip.yaml
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: aviingressclass-tkg-wkld-trf-vip
spec:
controller: ako.vmware.com/avi-lb
parameters:
apiGroup: ako.vmware.com
kind: AviInfraSetting
name: aviinfrasetting-tkg-wkld-trf-vip
dashboard-ingress.yaml
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-ingress
namespace: tanzu-system-dashboards
annotations:
ako.vmware.com/enable-tls: "true"
labels:
app: dashboard-ingress
spec:
ingressClassName: aviingressclass-tkg-wkld-trf-vip
rules:
- host: "grafana.tkg-workload1.vmwire.com"
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: grafana
port:
number: 80
Below you can see that Grafana is now using the new AviInfraSetting and has been assigned an IP address of 172.16.4.98.
