This article explains how to allocate the object-specific FIP Pool and its corresponding scope.
For details on the three possible FIP scopes, refer to KB35083 - [Contrail] Understanding Floating IP Pool Scopes in Kubernetes environment. [juniper.net]
The object-specific FIP pool is the most specific level of FIP pool in Contrail 5 Kubernetes environment. You can specify an FIP Pool to a specific Kubernetes object, such as a 'service' or an 'Ingress'. After the object is created with the pool specified, the object will be assigned an FIP whenever it requires from this pool only. The typical use case of an object-specific FIP pool is when you want to assign a specific IP prefix or an IP prefix from a specific range, instead of the global IP pool.
Example of how to assign an IP pool to a particular service only:
---- #service-web-lb-pool-public-1.yaml apiVersion: v1 kind: Service metadata: name: service-web-lb-pool-public-1 annotations: "opencontrail.org/fip-pool": "{'domain': 'default-domain', 'project': 'k8s-ns-user-1', 'network': 'vn-public-1', 'name': 'pool-public-1'}" spec: ports: - port: 8888 targetPort: 80 selector: app: webserver type: LoadBalancer ----
#service-web-lb-pool-public-1.yaml apiVersion: v1 kind: Service metadata: name: service-web-lb-pool-public-1 annotations: "opencontrail.org/fip-pool": "{'domain': 'default-domain', 'project': 'k8s-ns-user-1', 'network': 'vn-public-1', 'name': 'pool-public-1'}" spec: ports: - port: 8888 targetPort: 80 selector: app: webserver type: LoadBalancer
In this example, the service 'service-web-lb-pool-public-1' will get an FIP from pool 'pool-public-1', which is created based on VN 'vn-public-1' under the current project 'k8s-ns-user-1'. The corresponding kubernetes NS is 'ns-user-1'. Since the object level FIP pool is assigned for this specific object only, with this method, each new object needs to be assigned an FIP pool explicitly.