Kong
Overview¶
Kong is an Ingress Controller for use on k8s clusters. Features include Ingress routing, low latency, API management which allows users to use various plugins. These plugins allow users to take advantage of additional features which provide monitoring, TLS termination, transformations, and Deep Packet Inspection. In addition users can take advantage of health checking, load-balancing, and authentication functionality.
What Will You Do¶
In this exercise,
- You will create a "kong" addon and use it in a custom cluster blueprint
- You will then apply this cluster blueprint to a managed cluster
Important
This tutorial describes the steps to create and use a custom cluster blueprint using the Web Console. The entire workflow can also be fully automated and embedded into an automation pipeline.
Assumptions¶
- You have already provisioned or imported one or more Kubernetes clusters using the controller.
Step 1: Download Kong YAML¶
Navigate to Kongs' GIT Repo and download the k8s yaml file "all-in-one-dbless.yaml".
Step 2: Create Kong Addon¶
- Login into the Web Console and navigate to your Project as an Org Admin or Infrastructure Admin
- Under Infrastructure, select "Namespaces" and create a new namespace called "kong"
- Select "Addons" and "Create" a new Addon called "kong" by selecting the "+ New Add-On" button
- Ensure that you select "k8s YAML" for type and select the namespace as "kong"
- Provide the "all-in-one-dbless.yaml" from the previous step and select "CREATE"
- Click on "+ New Version"
- Enter "v1.0.0" for the Version Name and "UPLOAD" the k8s Yaml File downloaded in step 1
- Select "Save Changes"
Once the addon is created, ensure you publish it and optionally provide a version so that it can be tracked.
Step 3: Create Blueprint¶
Now, we are ready to assemble a custom cluster blueprint using the addons.
- Under Infrastructure, select "Blueprints"
- Create a new blueprint and give it a name such as "kong"
- Create a new version of the blueprint by selecting "+ New Version"
- Enter a version name such as "1.0" and add the appropriate Add-Ons.
- Ensure that you have the managed Ingress disabled
Once the blueprint is created, ensure you publish it and optionally provide a version so that it can be tracked.
Step 4: Apply Blueprint¶
Now, we are ready to apply this custom blueprint to a cluster.
- Click on Options for the target Cluster in the Web Console
- Select "Update Blueprint" and select the "kong" blueprint and appropriate version we created from the list
Click on "Save and Publish". This will start the deployment of the addons configured in the "alb-ingress" blueprint to the targeted cluster. The blueprint sync process can take a few minutes. Once complete, the cluster will display the current cluster blueprint details and whether the sync was successful or not. See illustrative example below.
Step 5: Verify Deployment¶
Users can optionally verify whether the correct resources have been created on the cluster.
- Click on the Kubectl button on the cluster to open a virtual terminal
- First, we will verify if the kong namespace has been created
kubectl get ns kong
NAME STATUS AGE
kong Active 9m32s
- Next, we will verify the pods in the "kong" namespace. You should see something like the example below.
kubectl get po -n kong
NAME READY STATUS RESTARTS AGE
ingress-kong-6868f56458-mq6dn 2/2 Running 0 5m21s
Step 6: Create Workload¶
- Copy the file below and save as kong-ingress.yaml
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: demo annotations: kubernetes.io/ingress.class: kong spec: rules: - host: kong.dev.rafay-edge.net http: paths: - path: /foo backend: serviceName: echo servicePort: 80
- Under Applications, select "Workloads"
-
Select "New Workload" and enter a Name, set Package Type to "k8s YAML", and select the Namespace
-
Upload file kong-ingress.yaml
-
Set Drift Action and Placement Policy
-
Publish Workload
Step 7: Verify Workload¶
- Click on the Kubectl button on the cluster to open a virtual terminal and run the following kubectl command
kubectl get ingresses -n david-private-ns
NAME CLASS HOSTS ADDRESS PORTS AGE
demo <none> kong.dev.rafay-edge.net ad570dd03c48746bf8b0fadd4fa08f47-708c18117257066b.elb.us-west-1.amazonaws.com 80 2m53s
Recap¶
Congratulations! You have successfully created a custom cluster blueprint with the "kong" addon and applied to a cluster. You can now use this blueprint on as many clusters as you require.