Skip to content

After Modified service targetPort, the targetPort not sync to cooresponing backend  #11863

@zengyuxing007

Description

@zengyuxing007

What happened:

After Modified service targetPort, the targetPort not sync to cooresponing backend

kubectl get svc nginx-svc

apiVersion: v1
kind: Service
metadata:
  annotations:
    aa: aaa
  creationTimestamp: "2024-08-22T03:44:11Z"
  labels:
    aa: ccc
  name: nginx-svc
  namespace: default
  resourceVersion: "1998073"
  uid: a936ed5d-6b33-4175-9ae3-405c53131c8f
spec:
  clusterIP: 172.30.86.90
  clusterIPs:
  - 172.30.86.90
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: http
    port: 8080
    protocol: TCP
    targetPort: 8336
  selector:
    app: nginx
  sessionAffinity: None
  type: ClusterIP

but the cooresponing backends port not be synced.

kubectl exec deployment/nginx-ingress-controller -n kube-system  -- /dbg backends get default-nginx-svc-8080


Defaulted container "nginx-ingress-controller" out of: nginx-ingress-controller, init-sysctl (init)
{
  "endpoints": [
    {
      "address": "10.0.0.139",
      "port": "8335"
    }
  ],
  "name": "default-nginx-svc-8080",
  "noServer": false,
  "port": 8080,
  "service": {
    "metadata": {
      "creationTimestamp": null
    },
    "spec": {
      "clusterIP": "172.30.86.90",
      "clusterIPs": [
        "172.30.86.90"
      ],
      "internalTrafficPolicy": "Cluster",
      "ipFamilies": [
        "IPv4"
      ],
      "ipFamilyPolicy": "SingleStack",
      "ports": [
        {
          "name": "http",
          "port": 8080,
          "protocol": "TCP",
          "targetPort": 8335
        }
      ],
      "selector": {
        "app": "nginx"
      },
      "sessionAffinity": "None",
      "type": "ClusterIP"
    },
    "status": {
      "loadBalancer": {}
    }
  },
  "sessionAffinityConfig": {
    "cookieSessionAffinity": {
      "name": ""
    },
    "mode": "",
    "name": ""
  },
  "sslPassthrough": false,
  "trafficShapingPolicy": {
    "cookie": "",
    "header": "",
    "headerPattern": "",
    "headerValue": "",
    "weight": 0,
    "weightTotal": 0
  },
  "upstreamHashByConfig": {
    "upstream-hash-by-subset-size": 3
  }
}

What you expected to happen:

the coorespoing backend port is synced to 8336

image

From the log information, we can see the detailed processing of the service update event, and ultimately, the backend update is ignored.

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):

v1.10.4

Kubernetes version (use kubectl version):
v1.22.15

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
    • Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
  • Basic cluster related info:
    • kubectl version
      v1.22.15
    • kubectl get nodes -o wide

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportCategorizes issue or PR as a support question.needs-priorityneeds-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.triage/needs-informationIndicates an issue needs more information in order to work on it.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions