|
6 | 6 | [id="nw-externalip-about_{context}"]
|
7 | 7 | = About ExternalIP
|
8 | 8 |
|
9 |
| -For non-cloud environments, {product-title} supports the assignment of external IP addresses to a `Service` object `spec.externalIPs[]` field through the *ExternalIP* facility. |
10 |
| -By setting this field, {product-title} assigns an additional virtual IP address to the service. The IP address can be outside the service network defined for the cluster. |
11 |
| -A service configured with an ExternalIP functions similarly to a service with `type=NodePort`, allowing you to direct traffic to a local node for load balancing. |
| 9 | +For non-cloud environments, {product-title} supports the use of the ExternalIP facility to specify external IP addresses in the `spec.externalIPs[]` parameter of the `Service` object. A service configured with an ExternalIP functions similarly to a service with `type=NodePort`, whereby you traffic directs to a local node for load balancing. |
12 | 10 |
|
13 |
| -You must configure your networking infrastructure to ensure that the external IP address blocks that you define are routed to the cluster. As a result, the IP address is not configured in the network interfaces from nodes. To handle the traffic, you must configure the routing and access to the external IP by using a method such as static Address Resolution Protocol (ARP) entries. |
14 |
| - |
15 |
| -{product-title} extends the ExternalIP functionality in Kubernetes by adding the following capabilities: |
16 |
| - |
17 |
| -- Restrictions on the use of external IP addresses by users through a configurable policy |
18 |
| -- Allocation of an external IP address automatically to a service upon request |
19 |
| -
|
20 |
| -[WARNING] |
| 11 | +[IMPORTANT] |
21 | 12 | ====
|
22 |
| -Disabled by default, use of ExternalIP functionality can be a security risk, because in-cluster traffic to an external IP address is directed to that service. |
23 |
| -This could allow cluster users to intercept sensitive traffic destined for external resources. |
| 13 | +For cloud environments, use the load balancer services for automatic deployment of a cloud load balancer to target the endpoints of a service. |
24 | 14 | ====
|
25 | 15 |
|
26 |
| -[IMPORTANT] |
| 16 | +After you specify a value for the parameter, {product-title} assigns an additional virtual IP address to the service. The IP address can exist outside of the service network that you defined for your cluster. |
| 17 | + |
| 18 | +[WARNING] |
27 | 19 | ====
|
28 |
| -This feature is supported only in non-cloud deployments. |
29 |
| -For cloud deployments, use the load balancer services for automatic deployment of a cloud load balancer to target the endpoints of a service. |
| 20 | +Because ExternalIP is disabled by default, enabling the ExternalIP functionality might introduce security risks for the service, because in-cluster traffic to an external IP address is directed to that service. This configuration means that cluster users could intercept sensitive traffic destined for external resources. |
30 | 21 | ====
|
31 | 22 |
|
32 | 23 | You can use either a MetalLB implementation or an IP failover deployment to attach an ExternalIP resource to a service in the following ways:
|
33 | 24 |
|
34 | 25 | Automatic assignment of an external IP::
|
35 |
| -{product-title} automatically assigns an IP address from the `autoAssignCIDRs` CIDR block to the `spec.externalIPs[]` array when you create a `Service` object with `spec.type=LoadBalancer` set. |
36 |
| -In this case, {product-title} implements a non-cloud version of the load balancer service type and assigns IP addresses to the services. |
37 |
| -Automatic assignment is disabled by default and must be configured by a cluster administrator as described in the following section. |
| 26 | +{product-title} automatically assigns an IP address from the `autoAssignCIDRs` CIDR block to the `spec.externalIPs[]` array when you create a `Service` object with `spec.type=LoadBalancer` set. For this configuration, {product-title} implements a cloud version of the load balancer service type and assigns IP addresses to the services. Automatic assignment is disabled by default and must be configured by a cluster administrator as described in the "Configuration for ExternalIP" section. |
38 | 27 |
|
39 | 28 | Manual assignment of an external IP::
|
40 | 29 | {product-title} uses the IP addresses assigned to the `spec.externalIPs[]` array when you create a `Service` object. You cannot specify an IP address that is already in use by another service.
|
41 | 30 |
|
42 |
| -[id="configuration-externalip_{context}"] |
43 |
| -== Configuration for ExternalIP |
44 |
| - |
45 |
| -Use of an external IP address in {product-title} is governed by the following fields in the `Network.config.openshift.io` CR named `cluster`: |
46 |
| - |
47 |
| -* `spec.externalIP.autoAssignCIDRs` defines an IP address block used by the load balancer when choosing an external IP address for the service. {product-title} supports only a single IP address block for automatic assignment. This can be simpler than having to manage the port space of a limited number of shared IP addresses when manually assigning ExternalIPs to services. If automatic assignment is enabled, a `Service` object with `spec.type=LoadBalancer` is allocated an external IP address. |
48 |
| -* `spec.externalIP.policy` defines the permissible IP address blocks when manually specifying an IP address. {product-title} does not apply policy rules to IP address blocks defined by `spec.externalIP.autoAssignCIDRs`. |
49 |
| - |
50 |
| -If routed correctly, external traffic from the configured external IP address block can reach service endpoints through any TCP or UDP port that the service exposes. |
51 |
| - |
52 |
| -[IMPORTANT] |
53 |
| -==== |
54 |
| -As a cluster administrator, you must configure routing to externalIPs. You must also ensure that the IP address block you assign terminates at one or more nodes in your cluster. For more information, see link:https://kubernetes.io/docs/concepts/services-networking/service/#external-ips[*Kubernetes External IPs*]. |
55 |
| -==== |
56 |
| - |
57 |
| -{product-title} supports both the automatic and manual assignment of IP |
58 |
| -addresses, and each address is guaranteed to be assigned to a maximum of one |
59 |
| -service. This ensures that each service can expose its chosen ports regardless |
60 |
| -of the ports exposed by other services. |
| 31 | +After using either the MetalLB implementation or an IP failover deployment to host external IP address blocks, you must configure your networking infrastructure to ensure that the external IP address blocks are routed to your cluster. This configuration means that the IP address is not configured in the network interfaces from nodes. To handle the traffic, you must configure the routing and access to the external IP by using a method, such as static Address Resolution Protocol (ARP) entries. |
61 | 32 |
|
62 |
| -[NOTE] |
63 |
| -==== |
64 |
| -To use IP address blocks defined by `autoAssignCIDRs` in {product-title}, you must configure the necessary IP address assignment and routing for your host network. |
65 |
| -==== |
66 |
| - |
67 |
| -The following YAML describes a service with an external IP address configured: |
68 |
| - |
69 |
| -.Example `Service` object with `spec.externalIPs[]` set |
70 |
| -[source,yaml] |
71 |
| ----- |
72 |
| -apiVersion: v1 |
73 |
| -kind: Service |
74 |
| -metadata: |
75 |
| - name: http-service |
76 |
| -spec: |
77 |
| - clusterIP: 172.30.163.110 |
78 |
| - externalIPs: |
79 |
| - - 192.168.132.253 |
80 |
| - externalTrafficPolicy: Cluster |
81 |
| - ports: |
82 |
| - - name: highport |
83 |
| - nodePort: 31903 |
84 |
| - port: 30102 |
85 |
| - protocol: TCP |
86 |
| - targetPort: 30102 |
87 |
| - selector: |
88 |
| - app: web |
89 |
| - sessionAffinity: None |
90 |
| - type: LoadBalancer |
91 |
| -status: |
92 |
| - loadBalancer: |
93 |
| - ingress: |
94 |
| - - ip: 192.168.132.253 |
95 |
| ----- |
96 |
| - |
97 |
| -[id="restrictions-on-ip-assignment_{context}"] |
98 |
| -== Restrictions on the assignment of an external IP address |
99 |
| - |
100 |
| -As a cluster administrator, you can specify IP address blocks to allow and to reject. |
101 |
| - |
102 |
| -Restrictions apply only to users without `cluster-admin` privileges. A cluster administrator can always set the service `spec.externalIPs[]` field to any IP address. |
103 |
| - |
104 |
| -You configure IP address policy with a `policy` object defined by specifying the `spec.ExternalIP.policy` field. |
105 |
| -The policy object has the following shape: |
106 |
| - |
107 |
| -[source,json] |
108 |
| ----- |
109 |
| -{ |
110 |
| - "policy": { |
111 |
| - "allowedCIDRs": [], |
112 |
| - "rejectedCIDRs": [] |
113 |
| - } |
114 |
| -} |
115 |
| ----- |
116 |
| - |
117 |
| -When configuring policy restrictions, the following rules apply: |
118 |
| - |
119 |
| -- If `policy={}` is set, then creating a `Service` object with `spec.ExternalIPs[]` set will fail. This is the default for {product-title}. The behavior when `policy=null` is set is identical. |
120 |
| -- If `policy` is set and either `policy.allowedCIDRs[]` or `policy.rejectedCIDRs[]` is set, the following rules apply: |
121 |
| - |
122 |
| -* If `allowedCIDRs[]` and `rejectedCIDRs[]` are both set, then `rejectedCIDRs[]` has precedence over `allowedCIDRs[]`. |
123 |
| -* If `allowedCIDRs[]` is set, creating a `Service` object with `spec.ExternalIPs[]` will succeed only if the specified IP addresses are allowed. |
124 |
| -* If `rejectedCIDRs[]` is set, creating a `Service` object with `spec.ExternalIPs[]` will succeed only if the specified IP addresses are not rejected. |
125 |
| - |
126 |
| -[id="example-policy-objects_{context}"] |
127 |
| -== Example policy objects |
128 |
| - |
129 |
| -The examples that follow demonstrate several different policy configurations. |
130 |
| - |
131 |
| -- In the following example, the policy prevents {product-title} from creating any service with an external IP address specified: |
132 |
| -+ |
133 |
| -.Example policy to reject any value specified for `Service` object `spec.externalIPs[]` |
134 |
| -[source,yaml] |
135 |
| ----- |
136 |
| -apiVersion: config.openshift.io/v1 |
137 |
| -kind: Network |
138 |
| -metadata: |
139 |
| - name: cluster |
140 |
| -spec: |
141 |
| - externalIP: |
142 |
| - policy: {} |
143 |
| - ... |
144 |
| ----- |
145 |
| - |
146 |
| -- In the following example, both the `allowedCIDRs` and `rejectedCIDRs` fields are set. |
147 |
| -+ |
148 |
| -.Example policy that includes both allowed and rejected CIDR blocks |
149 |
| -[source,yaml] |
150 |
| ----- |
151 |
| -apiVersion: config.openshift.io/v1 |
152 |
| -kind: Network |
153 |
| -metadata: |
154 |
| - name: cluster |
155 |
| -spec: |
156 |
| - externalIP: |
157 |
| - policy: |
158 |
| - allowedCIDRs: |
159 |
| - - 172.16.66.10/23 |
160 |
| - rejectedCIDRs: |
161 |
| - - 172.16.66.10/24 |
162 |
| - ... |
163 |
| ----- |
| 33 | +{product-title} extends the ExternalIP functionality in Kubernetes by adding the following capabilities: |
164 | 34 |
|
165 |
| -- In the following example, `policy` is set to `null`. |
166 |
| -If set to `null`, when inspecting the configuration object by entering `oc get networks.config.openshift.io -o yaml`, the `policy` field will not appear in the output. |
167 |
| -+ |
168 |
| -.Example policy to allow any value specified for `Service` object `spec.externalIPs[]` |
169 |
| -[source,yaml] |
170 |
| ----- |
171 |
| -apiVersion: config.openshift.io/v1 |
172 |
| -kind: Network |
173 |
| -metadata: |
174 |
| - name: cluster |
175 |
| -spec: |
176 |
| - externalIP: |
177 |
| - policy: null |
178 |
| - ... |
179 |
| ----- |
| 35 | +- Restrictions on the use of external IP addresses by users through a configurable policy |
| 36 | +- Allocation of an external IP address automatically to a service upon request |
0 commit comments