Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to restart Pods with sidecar containers #81

Open
lucassus opened this issue Jan 23, 2025 · 1 comment
Open

Failed to restart Pods with sidecar containers #81

lucassus opened this issue Jan 23, 2025 · 1 comment

Comments

@lucassus
Copy link

I have the following deployment that uses a sidecar container (https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/):

  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: ***
    annotations:
      secrets.doppler.com/reload: "true"
  spec:
    replicas: 1
    selector:
      matchLabels:
        app.kubernetes.io/name: web
        app.kubernetes.io/instance: release-name
    template:
      spec:
        serviceAccountName: ***
        restartPolicy: Always
        terminationGracePeriodSeconds: 30
        initContainers:
          # Native sidecar container, see https://kubernetes.io/blog/2023/08/25/native-sidecar-containers/
          - name: haproxy-redis-sidecar
            image: haproxy:3.0.5
            imagePullPolicy: IfNotPresent
            restartPolicy: Always
            args: ["-V", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
            volumeMounts:
              - name: haproxy-redis-cfg
                mountPath: /usr/local/etc/haproxy/haproxy.cfg
            readinessProbe:
              exec:
                command: ["cat", "/dev/null"]
              initialDelaySeconds: 5
              periodSeconds: 5
              timeoutSeconds: 5
              successThreshold: 1
              failureThreshold: 3
        containers:
        - name: ab
          envFrom:
            # Load environment variables from the Doppler
            - secretRef:
                name: ***
          ....

For some reason Doppler Operator can't sync secrets for this deployment.
I have lots of errors like:

2025-01-20T16:16:34.906Z	ERROR	controllers.DopplerSecret	Unable to reconcile deployment	{"dopplersecret": "doppler-operator-system/***", "error": "Failed to update deployment annotation: Deployment.apps \"web-***\" is invalid: spec.template.spec.initContainers[0].readinessProbe: Forbidden: may not be set for init containers without restartPolicy=Always"}
@nmanoogian
Copy link
Member

Thanks for reporting this, @lucassus! We'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants