_# Huawei Cloud Controller Manager Configurations
There are 2 sets of configurations, as follows:
-
Huawei Cloud Configuration- the configuration information of Huawei Cloud. -
Loadbalancer Configuration- global configuration of the ELB service.
The configuration is stored in cloud-config(namespace: kube-system) secret.
See create the cloud-config secret to creating secret in Kubernetes cluster.
The cloud-config structure is as follows:
[Global]
region=
access-key=
secret-key=
project-id=
cloud=
auth-url=
[Vpc]
id=
subnet-id=
security-group-id=After modification, CCM needs to be restarted to load the data.
The following arguments are supported:
This section provides Huawei Cloud IAM configuration and authentication information.
-
regionRequired. This is the Huawei Cloud region.Note: The
regionmust be the same as the ECS of the Kubernetes cluster. -
access-keyRequired. The access key of the Huawei Cloud. -
secret-keyRequired. The secret key of the Huawei Cloud. -
project-idOptional. The Project ID of the Huawei Cloud. See Obtaining a Project ID.Note: The
project-idmust be the same as the ECS of the Kubernetes cluster. -
cloudOptional. The endpoint of the cloud provider. Defaults tomyhuaweicloud.com'`. -
auth-urlOptional. The Identity authentication URL. Defaults tohttps://iam.{cloud}:443/v3/.
This section contains network configuration information.
-
idOptional. Specifies the VPC used by ECS of the Kubernetes cluster. -
subnet-idOptional. Specifies the IPv4 subnet ID used by ECS of the Kubernetes cluster. -
security-group-idOptional. A security group ID used for associating with nodes. When new nodes are added to the cluster, they will be automatically associated with the security group. Conversely, when nodes are removed, the association will be automatically removed as well.
These arguments will be applied when the annotation in the service is empty.
It needs to be stored in the loadbalancer-config ConfigMap in kube-system namespace.
Since
v0.26.4, thehuawei-cloud-providernamespace is no longer used, andkube-systemis used instead. If you created theloadbalancer-configin thehuawei-cloud-providernamespace, it will still work, but we recommend that you migrate it tokube-system.
Here's an example:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: kube-system
name: loadbalancer-config
data:
loadBalancerOption: |-
{
"lb-algorithm": "ROUND_ROBIN",
"keep-eip": false,
"session-affinity-flag": "on",
"session-affinity-option": {
"type": "SOURCE_IP",
"persistence_timeout": 15
},
"disable-create-security-group": false,
"health-check-flag": "on",
"health-check-option": {
"delay": 5,
"timeout": 15,
"max_retries": 5
}
}After modification, CCM needs to be restarted to load the data.
The following arguments are supported:
-
lb-algorithmSpecifies the load balancing algorithm of the backend server group.The value range varies depending on the protocol of the backend server group:
ROUND_ROBIN: indicates the weighted round-robin algorithm.
LEAST_CONNECTIONS: indicates the weighted least connections algorithm.
SOURCE_IP: indicates the source IP hash algorithm.
When the value is SOURCE_IP, the weights of backend servers in the server group are invalid.
-
session-affinity-flagSpecifies whether to enable session affinity. Valid values areonandoff, defaults tooff. -
session-affinity-optionSpecifies the sticky session timeout duration in minutes.This parameter is mandatory when the
session-affinity-flagison.This is a json string, such as
{"type": "SOURCE_IP", "persistence_timeout": 15}.For details:
-
typeRequired. Specifies the sticky session type.The value range varies depending on the protocol of the backend server group:
SOURCE_IP: Requests are distributed based on the client's IP address.
Requests from the same IP address are sent to the same backend server.
HTTP_COOKIE: When the client sends a request for the first time, the load balancer automatically generates a cookie and inserts the cookie into the response message.
Subsequent requests are sent to the backend server that processes the first request.
APP_COOKIE: When the client sends a request for the first time, the backend server that receives the request generates a cookie and inserts the cookie into the response message.
Subsequent requests are sent to this backend server.
When the protocol of the backend server group is
TCP, only SOURCE_IP takes effect.When the protocol of the backend server group is
HTTP, only HTTP_COOKIE or APP_COOKIE takes effect. -
cookie_nameOptional. Specifies the cookie name.This parameter is mandatory when the sticky session type is APP_COOKIE.
-
persistence_timeoutOptional. Specifies the sticky session timeout duration in minutes.This parameter is invalid when
typeis set to APP_COOKIE.The value range varies depending on the protocol of the backend server group:
When the protocol of the backend server group is
TCPorUDP, the value ranges from1to60.When the protocol of the backend server group is
HTTPorHTTPS, the value ranges from1to1440.
See Adding a Backend Server Group for detailed usage.
-
-
keep-eipSpecifies whether to retain the EIP when deleting a ELB service. Valid values aretrueandfalse, defaults tofalse. -
health-check-flagSpecifies whether to enable health check for a backend server group. Valid values areonandoff, defaults toon.When health check is enabled, CCM will add a new inbound rule to one of the security groups of the backend service, allowing traffic from
100.125.0.0/16. This rule will be removed when all LoadBalance services are removed.100.125.0.0/16are internal IP addresses used by ELB to check the health of backend servers. -
health-check-optionSpecifies the health check.This parameter is mandatory when the
health-checkison.This is a json string, defaults to
{"delay": 5, "timeout": 3, "max_retries": 3}.For details:
-
delayRequired. Specifies the maximum time between health checks in the unit of second. The value ranges from1to50. Defaults to5. -
max_retriesRequired. Specifies the maximum number of retries. The value ranges from1to10. Defaults to3. -
timeoutRequired. Specifies the health check timeout duration in the unit of second. The value ranges from1to50. Defaults to3.
-
-
enable-transparent-client-ipSpecifies whether to pass source IP addresses of the clients to backend servers. Valid values are'true'and'false'.TCP or UDP listeners of shared load balancers: The value can be true or false, and the default value is false if this annotation is not passed.
HTTP or HTTPS listeners of shared load balancers: The value can only be true, and the default value is true if this annotation is not passed.
All listeners of dedicated load balancers: The value can only be true, and the default value is true if this annotation is not passed.
Note:
If this function is enabled, the load balancer communicates with backend servers using their real IP addresses. Ensure that security group rules and access control policies are correctly configured.
If this function is enabled, a server cannot serve as both a backend server and a client.
If this function is enabled, backend server specifications cannot be changed.
-
enable-cross-vpcOptional. Specifies whether to enable cross-VPC backend. The value can betrue(enable cross-VPC backend) orfalse(disable cross-VPC backend). The value can only be updated totrue. Only dedicated load balancer service will use this annotation. -
l4-flavor-idOptional. Specifies the ID of a flavor at Layer 4. Only dedicated load balancer service will use this annotation. -
l7-flavor-idOptional. Specifies the ID of a flavor at Layer 7. Only dedicated load balancer service will use this annotation. -
disable-create-security-groupOptional. Disable automatic creation of security groups for ELB health checks. Valid values are'true'and'false'. The default is'false'. -
business-nameOptional. Business name or business identifier used to compose the name of the Huawei Cloud ELB instance. To prevent the creation of ELB instances with the same name in Huawei Cloud when using the same tenant account in multiple K8s clusters, which may ultimately cause CCM to malfunction. For example,business-name: order-pass, kubernetes loadbalancer service namespace/name:default/order-service, then the name of the ELB instance is:k8s_service_order-pass_default_order-service.Note: Changing this will create new ELB instances, the old ELB instances will not be deleted and no longer maintained.
-
primary-nicOptional. If you want to use the node's primary network card as the back-end service of ELB, please configureforce, otherwise use HostIP of pod.