I'd like to start with some terminologies of IP addresses in GKE.
Network namespace: Based on the MAN page, a network namespace is logically another copy of the network stack, with its own routes, firewall rules, and network devices. This network namespace connects the node's physical network interface with the Pod. This network namespace is also connected to a Linux bridge allowing communication among pods on the same node and outside communication.
Pod IP: IP address assigned to a Pod and configurable during the Cluster creation within Pod Address Range option. GKE assign this IP to the virtual network interface in the Pod's network namespace and routed to the node's physical network interface, such as eth0.
Node IP: IP address assigned to the physical network interface of a Node as eth0
. This Node IP is configured on the network namespace to communicate with the pods.
Cluster IP: IP address assigned and stable for the lifetime of the service. Using the network namespace to allow communication between nodes and external network.
Here's the source of my information; GKE Network Overview where I also found this note:
Warning: Do not manually make changes to nodes because they are overridden by GKE, and your cluster may not function correctly. The only reason to access a node directly is to debug problems with your configuration.
Then if you looking to establish communication between your GKE cluster and another network, I would suggest the different services:
External Load Balancers manage traffic coming from outside the cluster and outside your Google Cloud Virtual Private Cloud (VPC) network. They use forwarding rules associated with the Google Cloud network to route traffic to a Kubernetes node.
Internal Load Balancers manage traffic coming from within the same VPC network. Like external load balancers, they use forwarding rules associated with the Google Cloud network to route traffic to a Kubernetes node.
HTTP(S) Load Balancers are specialized external load balancers used for HTTP(S) traffic. They use an Ingress resource rather than a forwarding rule to route traffic to a Kubernetes node.
You can find more details on the different services in this documentation.
In big picture, a pod cannot communicate directly with external resource.
You should use a service and expose the pod to the service.
--enable-ip-alias
? What is your--cluster-ipv4-cidr
param? Did you have activate secondary IP range? If so, with which values? – guillaume blaquieregcloud container clusters describe <cluster>
, gives me that theclusterIpv4Cidr: 10.12.0.0/14
andipAllocationPolicy: clusterIpv4Cidr: 10.12.0.0/14 clusterIpv4CidrBlock: 10.12.0.0/14 clusterSecondaryRangeName: gke-XXX-stack-cluster-pods-f28f6de4 servicesIpv4Cidr: 10.142.0.0/20 servicesIpv4CidrBlock: 10.142.0.0/20 servicesSecondaryRangeName: gke-XXX-stack-cluster-services-f28f6de4 useIpAliases: true
– Henke