Configuring an Access Policy for a Service
Overview
You can add IP addresses to a trustlist or blocklist to control access to a load balancer associated with the Service.
- Trustlist: Only the IP addresses in the list can access the load balancer.
- Blocklist: IP addresses in the list are not allowed to access the load balancer.
Prerequisites
IP address groups have been created on the ELB console. For details, see Creating an IP Address Group.
Configuring an Access policy
- Log in to the CCI 2.0 console.
- In the navigation pane, choose Services. On the right of the page, click Create from YAML.
- Import or add the YAML file of the Service. For details about the parameters, see Table 1.
The following is an example YAML file:
- Resource description in the service.yaml file
apiVersion: cci/v2 kind: Service metadata: name: kubectl-test namespace: kubectl annotations: kubernetes.io/elb.class: elb kubernetes.io/elb.id: 1234567890 # Load balancer ID. Only dedicated load balancers are supported. kubernetes.io/elb.acl-id: <your_acl_id> # ID of an IP address group for accessing the load balancer kubernetes.io/elb.acl-type: 'white' # Trustlist for access control spec: selector: app: kubectl-test ports: - name: service-0 targetPort: 80 # Container port port: 12222 # Access port (load balancer's port for accessing the workload) protocol: TCP # Protocol used to access the workload type: LoadBalancer
- Resource description in the service.json file
{ "apiVersion": "cci/v2", "kind": "Service", "metadata": { "name": "kubectl-test", "namespace": "kubectl", "annotations": { "kubernetes.io/elb.class": "elb" "kubernetes.io/elb.id": "1234567890" # Load balancer ID. Only dedicated load balancers are supported. kubernetes.io/elb.acl-id: <your_acl_id> # ID of an IP address group for accessing the load balancer "kubernetes.io/elb.acl-type": "white" # Trustlist for access control } }, "spec": { "selector": { "app": "kubectl-test" }, "ports": [ { "name": "service-0", "targetPort": 80, # Container port "port": 12222, # Access port (load balancer's port for accessing the workload) "protocol": "TCP", #Protocol used to access the workload "type": "LoadBalancer" } ] } }
- Resource description in the service.yaml file
- Click OK. Access the workload through the load balancer's IP address and port in the format of <IP-address>:<port>.
- If a trustlist is used for access control, only the IP addresses in the trustlist can access the load balancer.
- If a blocklist is used for access control, the IP addresses in the blocklist cannot access the load balancer.
Parameter |
Type |
Description |
---|---|---|
kubernetes.io/elb.acl-id |
String |
|
kubernetes.io/elb.acl-type |
String |
This parameter is mandatory when you configure an IP address blocklist or trustlist for a load balancer.
If kubernetes.io/elb.acl-id is specified but kubernetes.io/elb.acl-type is not, the trustlist is used by default. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot