The Application Load Balancer (ALB) Ingress controller provides powerful Ingress traffic management capabilities. The ALB Ingress controller can be used in container services such as Container Service for Kubernetes (ACK) and in self-managed Kubernetes clusters. You must authorize a self-managed Kubernetes cluster to use the ALB Ingress controller before you can use the ALB Ingress controller to manage traffic.
Step 1: Create a RAM user
Log on to the Resource Access Management (RAM) console by using an Alibaba Cloud account.
In the left-side navigation pane, choose Identities > Users. On the page that appears, click Create User.
On the Create User page, set the Logon Name and Display Name parameters, select OpenAPI Access, and then click OK.
On the Create User page, copy the AccessKey ID and AccessKey secret of the RAM user.
Step 2: Create a RAM policy and attach the policy to the RAM user
Create a policy to provide the permissions that are required for using the ALB Ingress controller.
In the left-side navigation pane of the RAM console, choose Permissions > Policies. On the right side of the page, click Create Policy.
Click the JSON tab, copy and paste the following content to the editor, and then click Next to edit policy information.
Set Name in the Basic Information section and click OK.
Attach the policy to the RAM user to authorize the RAM user to use the ALB Ingress controller.
In the left-side navigation pane, choose Identities > Users.
On the Users page, find the RAM user that you created and click Add Permissions in the Actions column.
In the Add Permissions panel, click Custom Policy, select a policy, keep the default settings for the other parameters, and then click OK.
Step 3: Configure the AccessKey ID and AccessKey secret in the self-managed cluster
Use Base64 to encode the AccessKey ID and AccessKey secret and obtain the encoded AccessKey pair.
Run the following command to add the Base64-encoded AccessKey ID and AccessKey secret to the load-balancer-config ConfigMap and save the ConfigMap:
vim <load-balancer-config ConfigMap file name>
The following code block shows an example of the load-balancer-config ConfigMap:
apiVersion: v1 kind: ConfigMap metadata: name: load-balancer-config namespace: kube-system data: cloud-config.conf: |- { "Global": { "AccessKeyID": "VndV***", # Specify the Base64-encoded AccessKey ID. "AccessKeySecret": "UWU0NnUyTFdhcG***" # Specify the Base64-encoded AccessKey secret. } }
Run the following command to deploy the load-balancer-config ConfigMap:
kubectl apply -f <load-balancer-config ConfigMap file name>
Restart the pod of load-balancer-controller for the configuration to take effect.
Run the following command to query the pod of load-balancer-controller:
kubectl get pod -n kube-system|grep load-balancer-controller
Run the following command to delete the pod of load-balancer-controller:
kubectl delete pod -n kube-system load-balancer-controller-***
Expected output:
pod load-balancer-controller-*** deleted
Run the following command to query the status of the pod that is recreated for load-balancer-controller:
kubectl get pod -n kube-system|grep load-balancer-controller
Expected output:
load-balancer-controller-0o9s*** 1/1 Running 0 10s
References
For more information about how to use the ALB Ingress controller in self-managed Kubernetes clusters, see the following topics: