Mtls blocking access from init-container

I am running an init-container to run some migration scripts against a postgres docker db.

However sclalchemy fails as follows:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) received invalid response to SSL negotiation:

Is there something specific I need to configure on my init-container to overcome this?

Here is the corresponding part of my helm template:

template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "true"
        {{- if eq $processType "server" }}
        readiness.status.sidecar.istio.io/applicationPorts: {{ default 5000 .ctx.Values.port | quote }}
        {{- end}}
      labels:
        component: "{{ Release.Name }}-foo"
    spec:
      {{- if eq $processType "server" }}
      initContainers:
        - name: init-postgres
          image: "{{ Values.image }}:{{ Values.tag }}"
          args: ["create_db"]
          envFrom:
          - secretRef:
              name: "{{ Release.Name }}-somesecret"
      {{- end}}
      containers:
        - name: "main-container"
          image: "{{ Values.image }}:{{ Values.tag }}"
          imagePullPolicy: {{ default "Always" .Values.imagePullPolicy }}

Assume I cannot mess with the actual python (i.e. sqlalchemy) code inside the image and disable TLS checks.

1 Like