How to install AMKO on Tanzu Kubernetes Clusters(TKC) / TKG-Service

How to install AMKO on Tanzu Kubernetes Clusters(TKC) / TKG-Service

***Disclaimer: If you are using TKG-Service with NSX-T network with AMKO, this solution is not supported by VMware at the moment. It would be good for POC / Testing only.

***Update (May 2021): I have tested this on vSphere 7.0U2, NSX-T 3.1 and AMKO 1.4.1, below steps are still valid.

Introduction

Well, let me guess. If you stumble on this blog post, I would assume you have seen the goodness and coolness of AKO (AVI Kubernetes Operator). While AKO provides superb Ingress Services for Kubernetes Cluster, you will start questioning yourself, what happens if you have multiple Kubernetes Cluster? How can I provide High Availablity Ingress Services or even better how can I load balance across my multiple Kubernetes Clsuters? The answer to these questions is AVI Multiple Kubernetes Operator(AMKO). There is a pretty good write-up on AMKO by one of the Solution Architecture from VMware-AVI team titled Deliver Elastic Kubernetes Ingress Controller and Services. I will put the link here for you to read about it.

Something about TKC. To be specific, when I mention about TKC, I’m referring to the TKG-Service. The easiest way to explain what is the TKG-Service is to make a comparison with TKG-Multi-Cloud. By the way, both TKG-S and TKG-M provides you on-demand Kubernetes Clusters. That means, you can create a Kubernetes Clusters using a YAML file with CLI. I tried spinning up two TKG-S in my customer production environment and it tooks less than 20 minutes! In short, basically, TKG-Service needs have vSphere 7.0 with Workload Management whereas TKG-Multi-Cloud, you can run it in vSphere 6.7 and above and in the Public Cloud.

Problem Statement

So, for most of the TKGs, the way you login to the cluster is using Token. However, for AMKO installation, you will need user accounts. Therefore, you will need create service accounts on the TKGs and cluster role binding for it, for the installation of AMKO. In this blog post, I will share the steps on how to do exactly this.

Pre-requisite

I would assume you already have AKO installed on your TKGs. My fellow colleague Ali Al Idrees did a phenomenon job in creating a guide on how to install AKO - NSX ALB in TKC. The additional thing you have to do is to create an additional TKG cluster.

##

Creating Kubernetes Service Accounts

  1. You can use this script to create Kubernetes User Account https://gist.github.com/hustshawn/e6109c6ddb7ed845e7a1298c526588b6

There is an small typo in this script. You have to change base64 -D to base -d.

  1. Create a Cluster Role Binding for the User Account you just created. kubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=tkc—04-admin1

Create gslb-members file.

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.30.10.8:6443
  name: tkc-04
- cluster:
    insecure-skip-tls-verify: true
    server: https://10.30.10.9:6443
  name: tkc-05
contexts:
- context:
    cluster: tkc-04
    user: tkc-04-admin1
  name: tkc-04
- context:
    cluster: tkc-05
    user: tkc-05-admin1
  name: tkc-05
current-context: tkc-04
kind: Config
preferences: {}
users:
- name: tkc-04-admin1
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURNRENDQWhpZ0F3SUJBZ0lVU2hQZXZnTlZ0TThFeVRQUHpjQ1lqN1pqL2pJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0ZURVRNQkVHQTFVRUF4TUthM1ZpWlhKdVpYUmxjekFlRncweU1ERXdNVEF3TVRNMk1EQmFGdzB5TVRFdwpNVEF3TVRNMk1EQmFNQzh4RlRBVEJnTlZCQW9UREc5eVoyRnVhWHBoZEdsdmJqRVdNQlFHQTFVRUF4TU5kR3RqCkxUQTBMV0ZrYldsdU1UQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQU1uQnAzYzYKT1ByRGlBWERhdmQwRklDU2kxdGY3RW5NUkpicEt4NUxZUXllYXVMQktaaWlCcnpFTW1hdTZFRUJmblg3NFd1dgowaTBTY1hRQ0dKTFVCSmtNQ3NMejdIcVdmYTdTTHcyQnQwczV6WW4yQlY4ckpDQ3k2emxLeWVjOUdEM0t4NTRTCjRaSldFV0dIY25hRU5MZytJL29ORlZqc2w2b04rMDNiMVRlUmRDSFY5dHIzL3B6VVd2REJxR3FwTERaeXhiNXIKK1g0bXFXMjNBUTQvNTFjSG1YeUw3Z1NtTGNVNlJQMmpQS2J2Q1FtQlk5eXJNcFN1SWJNdEhqN1RFeHRRbm5jUwpidGQ5T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KamwvSTNidEw0MlEySFgxUW1sZ0pRTnFOOUh2ZUdGCmhDdDg0aE8vZEdtbmlrRk9GbzhNU3dLQmdRQ0lvVXJwaitySkp1S01aR3drS3RUOG9HMklYblc3UnJDckZwZE0KZ3hncTNpdXk4Y1BueDNJMzNxbXFoQTNpWk4vdE9XWXB1MmtrV3RXdmIxMzIwQ0R0TUNDa0VPNXhRcVo2bEZRNgoyenlEMS9Ud3RCQTFNVTJXVWtUMlZTT0xCRXNGd3o3d0FYV3N3ZlBtM3hwTlpUZThlZElzK0c2SEFjRCtGMGMvCkhGQ3pBUUtCZ1FEZ3JQMlJOWHlrZXN2VDJFUG1Kd01mZjFrVklrZEl6bTRiR1JtSDFDWVovYTZxTExiSkttbHkKd3NXRDVkSUVIREFhdnJUZ2ZINm9TRUZjVmFQdUVnS2hHQ3R5QTFVeFdLVzZYUWZDSGREWk14NlFTbkZBRWQxUAowV2c5bmkvbG1CdnpCd1NsL0p0eXkxQkw1Mk9sdHIxaFdhd0M5N3RPQW01aHJ3TU50U0NQeXc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

Create gslb_values.yaml file

** This gslb_values.yaml file is based on AMKO 1.2. If you are using AMKO 1.4, please get the lastest values.yaml file using the below command.

helm show values ako/amko --version 1.4.1 > values.yaml
# Default values for amko.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
  repository: avinetworks/amko
  pullPolicy: IfNotPresent

configs:
  gslbLeaderController: ""
  controllerVersion: "20.1.1"
  memberClusters:
    - clusterContext: "tkc-04"
    - clusterContext: "tkc-05"
  refreshInterval: 1800
  logLevel: "INFO"

gslbLeaderCredentials:
  username: "admin" #Avi controller username
  password: "VMware1!" #Avi controller password

globalDeploymentPolicy:
  # appSelector takes the form of:
  appSelector:
    label:
      app: gslb
  # Uncomment below and add the required ingress/route/service label
  # appSelector:

  #namespaceSelector takes the form of:
  #namespaceSelector:
  #  label:
  #    ns: gslb   <example label key-value for namespace>
  # Uncomment below and add the reuqired namespace label
  # namespaceSelector:

  # list of all clusters that the GDP object will be applied to, can take any/all values
  # from .configs.memberClusters
  matchClusters:
    - "tkc-04"
    - "tkc-05"

  # list of all clusters and their traffic weights, if unspecified, default weights will be
  # given (optional). Uncomment below to add the required trafficSplit.
  # trafficSplit:
  #   - cluster: "cluster1-admin"
  #     weight: 8
  #   - cluster: "cluster2-admin"
  #     weight: 2

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

service:
  type: ClusterIP
  port: 80

persistentVolumeClaim: ""
mountPath: "/log"
logFile: "amko.log"

Install AMKO

kubectl create secret generic gslb-config-secret --from-file gslb-members -n avi-system

helm install amko/amko --generate-name --version 1.2.1 -f gslb_values.yaml --set configs.gslbLeaderController=10.115.1.41 --namespace=avi-system

Some Screenshots

NSX-T Topology

AVI SE on the same NSX-T Logical Segment as TKG worker nodes

AMKO Pod running successfully

Ingresses created by AKO on NSX ALB Controller

DNS Records with the Ingress FQDN created on NSX ALB GSLB

Testing AMKO - This shows, you will get two A records when you query the same FQDN

dig @10.115.1.3 test4.ako.acepod.com +short

Delete AMKO

kubectl delete secret gslb-config-secret -n avi-system
helm delete $(helm list -n avi-system -q | grep amko) -n avi-systems

Troubleshooting

kubectl get gdp -n avi-system -o yaml kubectl config use-context tkc-05 –kubeconfig gslb-members

kubectl get svc –kubeconfig

Closing Up

Thats about it! Hope you enjoy the greatness provided by AMKO for multi sites, multi cluster DNS Automation and Ingress Services Load Balancing.

Thanks for reading!

Reference

https://avinetworks.com/docs/amko/1.4/install-configure-amko/

https://avinetworks.com/docs/amko/1.2/install-configure-amko/