If you’re following along in the guides for TKGm, this is the last step, deploying the L7 ingress with Avi. Please make sure to read the post about deploying the L4 Type LoadBalancer since it covers creating the k8s docker secret: Create an L4 Type LoadBalancer with Avi
Enable Ingress in the management cluster
The first step is to navigate back to the management cluster context and edit the adc. By default the ingress features are disabled in tkgm. So we’ll enable ingress on the management cluster, and it will redeploy the AKO instance onto each guest cluster. (Unless labels were used in earlier steps..)
1 2 | kubectl config use-context management-cluster-1-admin@management-cluster-1 kubectl edit adc install -ako- for -all |
Look for and replace the following lines. It’s a vi editor, so “i” to edit, and hit Escape then type “:wq” to save
1 2 3 4 5 6 7 8 9 10 11 | ### FIND ### ingress: defaultIngressController: false disableIngressClass: true ### Replace With ### ingress: defaultIngressController: true disableIngressClass: false serviceType: NodePort shardVSSize: SMALL |
The above will force AKO pod to redeploy, you can see the new pod by running the following:
1 2 3 | kubectl config use-context guest-cluster-1-admin@guest-cluster-1 kubectl get pods -n avi-system kubectl logs ako-0 -n avi-system -f |
Give it about a minute or so for the new AKO pod to come up, then proceed.
Deploy the Bluegreen Application
Create the ingress.yaml file
So in the example below this application actually can change color between blue and green, depending on which environment value you set for the variable “app_color” [blue|green]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | --- apiVersion: apps/v1 kind: Deployment metadata: name: blue spec: selector: matchLabels: app: blue replicas: 2 template: metadata: labels: app: blue spec: containers: - name : blue image: alexfeig/bluegreen : latest ports: - containerPort : 5000 env: - name : app_color value: "blue" imagePullSecrets: - name : regcred --- --- apiVersion: v1 kind: Service metadata: name: blue spec: type: NodePort ports: - name : http port: 80 targetPort: 5000 protocol: TCP selector: app: blue --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: blue spec: rules: - host : blue.avi.home.lab http: paths: - path : / pathType: Prefix backend: service: name: blue port: number: 80 |
As you can see in the example yaml above, we’re creating 3 different objects. A deployment for the application to run 2 pods, a service Type NodePort, and finally a path based ingress.
Apply the ingress.yaml file
Save the above to a file called ingress.yaml and run the following command to apply it:
1 | kubectl apply -f ingress.yaml |
Validation



