Skip to content

Sidecar Containers for Services are not accessible #128825

@mbrancato

Description

@mbrancato

What happened?

I'm using a helm chart to deploy an application, and I typically insert an specific proxy I need as a legacy sidecar (after init). However, this helm chart specifically does now allow specifying additional containers (again, legacy sidecar pattern), but it does allow specifying init containers using the newer Sidecar Containers feature.

The sidecar config might look like this with the new sidecar pattern:

      initContainers:
        - name: myproxy
          image: myproxy
          restartPolicy: Always
          ports:
            - containerPort: 8080
              name: proxy-port
              protocol: TCP

After deploying this:

  • The v1/Service has endpoints that point to the target pods
  • Manually, I can connect to <pod IP>:8080
  • Attempting to connect to the service results in a connection refused.

What did you expect to happen?

The connection to the sidecar should work.

How can we reproduce it (as minimally and precisely as possible)?

  • Create a pod with a named port in a container under initContainers with restartPolicy: Always
  • Create a v1/Service that has a selector that targets the pod
  • Attempt to lookup the SRV record

Anything else we need to know?

No response

Kubernetes version

Details
Client Version: v1.31.0
Kustomize Version: v5.4.2
Server Version: v1.30.5-gke.1443001

Cloud provider

Details GKE

OS version

Details
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Details

Container runtime (CRI) and version (if applicable)

Details

Related plugins (CNI, CSI, ...) and versions (if applicable)

Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.sig/networkCategorizes an issue or PR as relevant to SIG Network.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions