Retrieve the CIDR Values from the Cluster¶
You must update the SPKInfrastructure CR with correct CIDR values as configured in your environment configurations.
Note: User can provide any name to thecidrList.nameandipPoolList.name.
In the bellow example,
- xx_cidr_ipv4 is the IPv4 network/subnet mentioned in the internal VLAN CR, see F5SPKVLAN.
- xx_cidr_ipv6 is the IPv6 network/subnet mentioned in the internal VLAN CR, see F5SPKVLAN.
egress:
json:
ipPoolCidrInfo:
cidrList:
- name: vlan_cidr_ipv4
value: "<IPv4 network/subnet>"
- name: vlan_ipv6_cidr
value: "<IPv6 network/subnet>"
- name: node_cidr_ipv4
value: "<IPv4 network/subnet>"
- name: node_cidr_ipv6
value: "<IPv6 network/subnet>"
ipPoolList:
- name: pod_cidr_ipv4
value: "<IPv4 network/subnet>"
- name: pod_cidr_ipv6
value: "<IPv6 network/subnet>"
To get the CIDR values and use them in the SPKInfrastructure CR, follow these instructions based on your CNI configuration:
IPv4 node/host subnet CIDR value¶
Use the below command to retrieve the node subnet value of the Kubernetes Cluster.
Flannel CNI:
kubectl get nodes -o jsonpath='{range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address}{"\n"}{end}' | awk -F. '{print $1"."$2"."$3".0/24"}' | sort -u
Calico CNI:
kubectl get node datkube-worker -o json | jq -r '.metadata.annotations["projectcalico.org/IPv4Address"]'
IPv6 node/host subnet CIDR value¶
Use the below command to retrieve the node ipv6 subnet value of the Kubernetes Cluster.
Flannel CNI:
kubectl get nodes -o jsonpath='{range .items[*]}{.status.addresses[?(@.type=="InternalIP")].address}{"\n"}{end}' | grep -E '([0-9a-fA-F]{1,4}:){2,7}[0-9a-fA-F]{1,4}' | head -n 1 | awk -F: '{print $1":"$2":"$3":"$4":0::/64"}' | awk '{print $2}'
Calico CNI:
kubectl get node datkube-worker -o json | jq -r '.metadata.annotations["projectcalico.org/IPv6Address"]'
IPv4 Pod subnet CIDR value¶
Use below command to retrieve the pod ipv4 subnet value:
Flannel CNI:
kubectl -n kube-flannel get configmap kube-flannel-cfg -o yaml | grep '"Network"' | awk -F '"' '{print $4}'
Calico CNI:
kubectl get ippools -o yaml | awk '/cidr:/ {if ($2 ~ ":") print "IPv6: " $2; else print "IPv4: " $2}' |grep IPv4
IPv6 Pod subnet CIDR value¶
Use below command to retrieve the pod ipv6 subnet value:
Flannel CNI:
kubectl -n kube-flannel get configmap kube-flannel-cfg -o yaml | grep '"IPv6Network"' | awk -F '"' '{print $4}'
Calico CNI:
kubectl get ippools -o yaml | awk '/cidr:/ {if ($2 ~ ":") print "IPv6: " $2; else print "IPv4: " $2}' |grep IPv6