The Application Load Balancer (ALB) Ingress controller provides powerful Ingress traffic management capabilities. This topic describes how to authorize a self-managed cluster to use the ALB Ingress controller before you can use the ALB Ingress controller to manage traffic.
Procedure
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 User Login Name and Display Name parameters, select Permanent AccessKey, 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 Editor tab, copy and paste the following content to the editor, then click OK.
-
In the Create Policy dialog box, set Name 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 in Step 1: Create a RAM user and click Attach Policy in the Actions column.
-
In the Attach Policy panel, in the Policy section, select Custom Policy from the drop-down list in the upper-right corner, select a policy, keep the default settings for the other parameters, then click OK.
-
Click Close.
-
Step 3: Configure the AccessKey ID and AccessKey secret in the self-managed cluster
-
Use Base64 to encode the AccessKey ID and AccessKey secret.
-
Visit Base64, enter the AccessKey ID on the page, then click Encode to obtain the encoded AccessKey ID.
-
Enter the AccessKey secret and click Encode to obtain the encoded AccessKey secret.
-
-
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": "<YOUR_ACCESS_KEY_ID>", # Specify the Base64-encoded AccessKey ID. "AccessKeySecret": "<YOUR_ACCESS_KEY_SECRET>" # 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-controllerExpected output:
load-balancer-controller-0o9s*** 1/1 Running 0 10s
-
Reference
Tutorial:
Use ALB Ingress on a self-managed K8s cluster
Source code documentation: