How do i bind to all ip-address?

195 Views Asked by At

I'm working on upgrading our eks cluster from 1.23 to 1.27. Some of the applications are failing because of the below error

Failed creating artifactory: java.net.ConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:8080
Failed creating archiva: java.net.ConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:8080

Service:

apiVersion: v1
kind: Service
metadata:
  name: xxx
  labels:
    app: abc
    heritage: "Tiller"
    chart: "jenkins-0.0.1"
    component: "jenkins-master"
  annotations:
spec:
  ports:
    - port: 80
      name: http
      targetPort: 8080
  selector:
    component: "jenkins-master"
  type: NodePort

This error looks like its resolving to ipv6 loopback address, AWS docs mention that i should bind to all ipaddress , How do i do? I tried disabling the ipv6 on the nodes, but i'm still getting the same error.

Containerd has IPv6 enabled for Pods, by default. It applies node kernel settings to Pod network namespaces. Because of this, containers in a Pod bind to both IPv4 (127.0.0.1) and IPv6 (::1) loopback addresses. IPv6 is the default protocol for communication. Before updating your cluster to version 1.24, we recommend that you test your multi-container Pods. Modify apps so that they can bind to all IP addresses on loopback interfaces. The majority of libraries enable IPv6 binding, which is backward compatible with IPv4. When it’s not possible to modify your application code, you have two options:

Run an init container and set disable ipv6 to true (sysctl -w net.ipv6.conf.all.disable ipv6=1).

1

There are 1 best solutions below

0
On

I resolved the issue, by passing an env variable to use ipv4 address, What i understood is that, its detecting ipv6 from containerd because i believe ipv6 is default. In jenkins used: -Djava.net.preferIPv4Stack=true and also for all deployments, I could not find any other solution.

Made sure, our cni

   - name: ENABLE_IPv4
      value: "true"
    - name: ENABLE_IPv6
      value: "false"