F5SPKEgress¶
Note
Deprecated as of 2.4.0. Use a GatewaySettings resource instead.
Overview¶
Function¶
Declares the egress configuration for a CNE instance, defining source network address translation, DNS/NAT46 and NAT64 translation, and egress traffic handling across TMM instances.
Names¶
Singular name |
Plural name |
Short name |
|---|---|---|
f5-spk-egress |
f5-spk-egresses |
egprof |
API group and version¶
k8s.f5net.com/v3
Scope¶
Namespace
Specification¶
metadata¶
Parameter |
Description |
|---|---|
name |
The unique name identifying the resource. For example, egress-cr |
namespace |
The namespace of Kubernetes in which the policy is applied. |
spec¶
Field |
Required |
Default |
Description |
|---|---|---|---|
|
No |
|
SNAT type to apply. Accepted values: |
|
No |
— |
Name of the SNAT pool. Set this when |
|
No |
|
SNAT address mode used by TMM pods. |
|
No |
|
VLAN used to forward traffic between TMM pods. Required when |
|
No |
|
Turns on extra protection for traffic between TMM pods. Applies only when |
|
No |
|
Turns on creation of both IPv4 and IPv6 wildcard virtual servers for egress connections. |
|
No |
|
Turns DNS functionality on or off. When |
|
No |
|
Turns on the DNS46/NAT46 feature. |
|
No |
— |
Pool of IP addresses that represent external DNS servers, or gateways to reach the DNS servers. |
|
No |
|
Pool of private IPv4 addresses used to create DNS A records for the internal pods. CIDR format. |
|
No |
|
IP address for the sorry page when the NAT pool is exhausted. IPv4 format. |
|
No |
|
Turns on DNS64/NAT64 translation for egress connections. |
|
No |
|
IPv6 subnet used for NAT64 translation. CIDR format. |
|
No |
|
Ceiling for DNS46 translation TTL, in seconds. AAAA TTLs greater than this value are set to this value. Accepted values: 1 to 2147483647. |
|
No |
|
Turns on debug logging for DNS46 translation. |
|
No |
|
Name of the required |
|
No |
|
Maximum number of operational TMM pods. This should equal the number of Self IP addresses. |
|
No |
|
Maximum number of IPv4 addresses reserved from |
|
No |
|
Rate limit for the DNS virtual server, per pod. To turn off the rate limit, set this to |
|
No |
— |
VLAN settings for egress traffic. |
|
No |
— |
Pseudo-CNI settings for the egress configuration. |
|
No |
|
Preferred acceleration mode for the Packet Velocity ASIC (PVA). |
|
No |
|
Name of the security firewall enforced policy. Maximum length is 255 characters. |
|
No |
|
Name of the security log profile. Maximum length is 255 characters. |
spec.vlans¶
Field |
Required |
Default |
Description |
|---|---|---|---|
|
No |
|
List of VLAN names. |
|
No |
|
When |
|
No |
|
VLAN category. The reserved words are |
spec.pseudoCNIConfig¶
Field |
Required |
Default |
Description |
|---|---|---|---|
|
No |
— |
List of application pod namespaces to which the egress configuration applies. |
|
No |
— |
Application pod’s network interface name from which egress traffic originates, for example |
|
No |
— |
Network interface name on the worker node. Egress traffic is directed to the TMM through this interface on the node where the application pod is deployed. |
|
No |
— |
Port number that the ingress virtual server listens on. Required when you configure pseudo-CNI and |
|
No |
— |
VXLAN settings for the pseudo-CNI configuration. |
spec.pseudoCNIConfig.vxlan¶
Field |
Required |
Default |
Description |
|---|---|---|---|
|
No |
|
When |
|
No |
— |
TMM interface name on which the VXLAN interface is created. This is the |
|
No |
— |
Network interface name on the worker node on which the VXLAN interface is created, for example |
|
No |
|
Maximum transmission unit for the tunnel. Accepted values: 68 to 65515. |
|
No |
|
UDP port number for VXLAN traffic. Accepted values: 0 to 65535. |
|
No |
|
VNI used for the tunnel. When set to |
|
No |
— |
IPv4 subnet from which addresses are assigned to VXLAN tunnel endpoints in the TMM and on worker nodes. Must be unique across all egress resources, for example |
|
No |
— |
Prefix length for the IPv4 subnet. Accepted values: 8 to 18. |
|
No |
— |
IPv6 subnet from which addresses are assigned to VXLAN tunnel endpoints in the TMM and on worker nodes. Must be unique across all egress resources, for example |
|
No |
— |
Prefix length for the IPv6 subnet. Accepted values: 104 to 114. |
|
No |
|
Name of the VRF (tenant) this VXLAN belongs to. When you don’t set this, the VXLAN is created in the default route domain. This field is immutable after creation. |
CR Modifications¶
Because this resource references a number of additional resources, F5 recommends that you always delete and reapply the resource, rather than using kubectl apply to modify a running resource’s configuration.
Note
This resource is immutable. It is recommended to delete and reapply the resource if you need to make modifications.
Egress SNAT¶
SNATs are used to modify the source IP address of egress packets leaving the cluster. When the BIG-IP Next for Kubernetes Traffic Management Microkernel (TMM) receives an internal packet from an internal Pod, the external (egress) packet source IP address will translate using a configured SNAT IP address. Using the this resource, you can apply SNAT IP addresses using either SNAT pools, or SNAT automap.
snatType
There are three types of SNAT:
Note
Currently, this resource use case with SNAT none type is not supported for GA.
SNAT none
When snatType is configured with SRC_TRANS_NONE, TMM uses application pod’s IP address to communicate with an external server.
SNAT pools
When snatType is configured with SRC_TRANS_SNATPOOL, TMM uses the configured MBIP server-side SNAT pools to communicate with an external server.
SNAT pools are lists of routable IP addresses, used by TMM to translate the source IP address of egress packets. SNAT pools provide a greater number of available IP addresses, and offer more flexibility for defining the SNAT IP addresses used for translation. If snatType is configured with the SRC_TRANS_SNATPOOL type, egressSnatpool will be used as a pool of addresses for source address translation for traffic that matches this F5SPKEgress CR. For more information to enable SNAT pools, see F5SPKSnatpool.
SNAT automap
When snatType is configured with SRC_TRANS_AUTOMAP, TMM uses the configured MBIP server side self IPs to communicate with an external server.
SNAT automap uses TMM’s external F5SPKVlan IP address as the source IP for egress packets. SNAT automap is easier to implement, and conserves IP address allocations. To use SNAT automap, do not include spec.egressSnatpool parameter. Use the installation procedure below to enable egress connectivity using SNAT automap.
Note
In clusters with multiple BIG-IP Next for Kubernetes Controller instances, ensure the IP addresses defined in each F5SPKSnatpool CR do not overlap.
Configuration dependencies based on snatType:
SRC_TRANS_SNATPOOL requires
egressSnatpool;pseudoCNIConfig.secureSPKIngressPortmust be omitted.SRC_TRANS_NONE requires
pseudoCNIConfig.secureSPKIngressPort;egressSnatpoolmust be omitted.SRC_TRANS_AUTOMAP requires neither field; both must be omitted.
Configure SNAT Automap¶
Follow the instructions below to set up the SNAT automap configuration:
Copy the below example manifest to a YAML file, then set the
namespaceparameter to the Controller’s Project and save.apiVersion: "k8s.f5net.com/v3" kind: F5SPKEgress metadata: name: egress-cr namespace: f5-bnk spec: dualStackEnabled: <true|false> snatType: SRC_TRANS_AUTOMAP
Apply the manifest.
kubectl apply -f <file name>
In this example, the resource file is named egress-cr.yaml:
kubectl apply -f egress-cr.yaml
Sample Output:
f5spkegress.k8s.f5net.com/egress-cr created
Internal Pods can now connect to external resources using the external F5SPKVlan self IP address.
Connection Statistics¶
Connect to the Debug Sidecar in the BIG-IP Next for Kubernetes to view the traffic processing statistics.
Log in to the BIG-IP Next for Kubernetes Debug container.
kubectl exec -it f5-tmm-wgrvm -c debug -n f5-bnk
View the traffic processing statistics.
tmctl -d blade virtual_server_stat -s name,serverside.tot_conns
In this example, 3 IPv4 connections, and 2 IPv6 connections have been initiated by internal Pods:
name serverside.tot_conns ----------------- -------------------- f5-bnk-egress-crd-egress-ipv6 2 f5-bnk-egress-crd-egress-ipv4 3
PseudoCNI¶
The Whole Cluster BIG-IP Next for Kubernetes utilises the F5SPKEgress CR to incorporate PseudoCNI configuration, which defines the necessary setting for egress traffic from application pods through TMM pods. The PseudoCNI Controller reads the PseudoCNI configuration from the F5SPKEgress CR and generates the necessary settings to designate TMMs as egress gateways. These mappings are shared with CSRC over GRPC. The CSRC daemonSet, running in privileged mode, configures rules and routes on nodes hosting application pods. The TMM running on the DPU local to the host node is given the highest priority compared to other TMMs.
Note
To ensure proper network communication and management, you must update the Felix configurations to include the TMM internal interface IPv4 Self-IPs. Use the kubectl patch felixconfiguration default --type='merge' -p='{"spec": {"externalNodesList": ["self-ip-address1", "self-ip-address2", "self-ip-address3"]}}' command to update the Felix configuration.
Configuring PseudoCNI¶
Prerequisites
Ensure you have:
A Linux-based workstation.
Installed F5SPKVlan.
Follow the instructions below to set up the PseudoCNI configuration using the F5SPKEgress CR:
Copy the below example F5SPKEgress CR into a YAML file, then modify PseudoCNI settings, snatpool and External VLAN Interface Name as required and save.
apiVersion: "k8s.f5net.com/v3" kind: F5SPKEgress metadata: name: egress-cr namespace: f5-bnk spec: dualStackEnabled: true snatType: SRC_TRANS_SNATPOOL egressSnatpool: egress-snatpool vlans: disableListedVlans: false vlanList: - vlan-external pseudoCNIConfig: namespaces: - app-ns-1 appPodInterface: "eth0" appNodeInterface: "spk-ms.3001"
Apply the F5SPKEgress CR that you have created.
kubectl apply -f egress-cr.yaml
Note
1. Using only VLAN in the egress CR (without VXLAN) is supported.
2. Make sure to configure one egress CR per namespace and one VLAN per egress CR. A single VLAN cannot be referred to in multiple egress CRs.
Configuring Dynamic Port Selection for CSRC-CNE Controller Communication¶
Port Conflict Issue from CSRC Logs:
ERROR: Failed to listen: listen tcp :8751: bind: address already in use
Cause:
As the CSRC daemonSet runs in the host network namespace, the CSRC gRPC port (default: 8751) may conflict with other applications using the same port in the host network.
FIX:
If a port conflict occurs during or after BIG-IP Next for Kubernetes installation, perform the following steps to fix this issue:
Update the Service Resource.
kubectl edit svc f5-csrc-grpc-svc
In the
csrc-grpc_service.yamlfile, modify:ports: - name: f5-csrc-grpc port: 8751 # Change to a new port (e.g., 8875) protocol: TCP targetPort: 8751 # Update to match the new port (e.g., 8875)
Update the DaemonSet Configuration.
kubectl edit daemonset spk-csrc
In the
daemonset.yamlfile, modify:- name: PSEUDOCNI_GRPC_PORT value: 8751 # Change to the new port (e.g., 8875)
The CSRC pods will automatically restart with the new port configuration, resolving the conflict.
VXLAN with F5SPKEgress CR¶
The setup process for the F5SPKVXLAN CR is automated to minimize the need for manual input and prevent errors. By using the specified tmmInterfaceName, the node interface is automatically identified and obtains the required underlay network information. It then chooses a unique Virtual Network Identifier (VNI) and subnet, and associates the VXLAN with the F5SPKEgress CR. These improvements simplify the configuration process, improve efficiency, and ensure accurate configurations with minimal user intervention.
Configuring VXLAN with F5SPKEgress CR¶
Prerequisites:
The underlying
F5SPKVlanCR, referred to in theF5SPKEgressCR astmmInterfaceName, must be created before creating theF5SPKEgressCR.If
pseudoCNIConfigis configured andvxlan.createis set to true.vlans.vlanListshould be empty.pseudoCNIConfig.appNodeInterfaceshould be empty.
If
pseudoCNIConfigis configured andvxlan.createis set to false.vlans.vlanListshould be populated, containing only one element.
If
vxlan.nodeInterfaceNameis configured, the specified interface will be used to create the VXLAN interface. Ifvxlan.nodeInterfaceNameis not configured or set to default, the appropriate interface on the node is automatically detected. This detected interface will be the one that can connect to the VLAN interface specified bytmmInterfaceNamein the TMM.When you configure a subnet for a VXLAN interface manually, ensure that unique VXLAN subnets are configured for all F5SPKEgress (VXLAN) CRs.
When you configure a VNI manually, ensure that the VNI is configured for all F5SPKEgress (VXLAN) CRs.
Follow the instructions below to set up the VXLAN configuration using the F5SPKEgress CR with default and specific configuration values:
Using default values
Copy the below example F5SPKEgress CR with default values into a YAML file, then modify VXLAN settings as required and save.
apiVersion: "k8s.f5net.com/v3" kind: F5SPKEgress metadata: name: egress-cr namespace: f5-bnk spec: dualStackEnabled: true snatType: SRC_TRANS_SNATPOOL egressSnatpool: egress-snatpool pseudoCNIConfig: namespaces: - app-ns-1 appPodInterface: "eth0" vxlan: create: true tmmInterfaceName: "vlan-internal"
Using Specific Configuration Values
Copy the below example F5SPKEgress CR with specific configuration values into a YAML file, then modify VXLAN settings as needed and save.
apiVersion: "k8s.f5net.com/v3" kind: F5SPKEgress metadata: name: egress-cr namespace: f5-bnk spec: dualStackEnabled: true snatType: SRC_TRANS_SNATPOOL egressSnatpool: egress-snatpool pseudoCNIConfig: namespaces: - app-ns-1 appPodInterface: "eth0" vxlan: create: true tmmInterfaceName: "vlan-internal" port: 4789 mtu: 1460 key: 100
Apply the F5SPKEgress CR that you have created.
kubectl apply -f egress-cr.yaml
Sample Output
f5spkegress.k8s.f5net.com/egress-cr created