linkerd / linkerd-extension-init

A utility for initializing Linkerd extension namespaces after installation
Apache License 2.0
2 stars 0 forks source link

Hostname mismatch on ipv6 kubernetes clusters #70

Open Gitopolis opened 1 month ago

Gitopolis commented 1 month ago

extension-init comes as a post-install hook in the linkerd-smi helm chart. This configuration works in ipv4 cluster, but fails in ipv6

Job manifest:

apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    helm.sh/hook: post-install
    helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
    helm.sh/hook-weight: '1'
  generation: 1
  labels:
    app.kubernetes.io/name: namespace-metadata
    app.kubernetes.io/part-of: linkerd-smi
    app.kubernetes.io/version: v0.2.7
  name: namespace-metadata
  namespace: linkerd
  resourceVersion: '82629'
  uid: ac2bfd1c-727f-46f0-905b-88236b59ecff
spec:
  backoffLimit: 6
  completionMode: NonIndexed
  completions: 1
  manualSelector: false
  parallelism: 1
  podReplacementPolicy: TerminatingOrFailed
  selector:
    matchLabels:
      batch.kubernetes.io/controller-uid: ac2bfd1c-727f-46f0-905b-88236b59ecff
  suspend: false
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/name: namespace-metadata
        app.kubernetes.io/part-of: linkerd-smi
        app.kubernetes.io/version: v0.2.7
        batch.kubernetes.io/controller-uid: ac2bfd1c-727f-46f0-905b-88236b59ecff
        batch.kubernetes.io/job-name: namespace-metadata
        controller-uid: ac2bfd1c-727f-46f0-905b-88236b59ecff
        job-name: namespace-metadata
    spec:
      containers:
        - args:
            - '--extension'
            - smi
            - '--namespace'
            - linkerd
            - '--linkerd-namespace'
            - linkerd
          image: cr.l5d.io/linkerd/extension-init:v0.1.1
          imagePullPolicy: IfNotPresent
          name: namespace-metadata
          resources: {}
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 65534
            seccompProfile:
              type: RuntimeDefault
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Never
      schedulerName: default-scheduler
      securityContext:
        seccompProfile:
          type: RuntimeDefault
      serviceAccount: namespace-metadata
      serviceAccountName: namespace-metadata
      terminationGracePeriodSeconds: 30
2024-10-11T03:01:15.417751Z INFO linkerd_extension_init: patching namespace linkerd
2024-10-11T03:01:15.424705Z ERROR kube_client::client::builder: failed with error error trying to connect: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:: hostname mismatch
Error: HyperError: error trying to connect: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:: hostname mismatch
Caused by:
0: error trying to connect: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:: hostname mismatch
1: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:: hostname mismatch
2: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:
3: error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:2092:

Steps to reproduce:

alpeb commented 1 month ago

Thanks for the detailed report; I was able to repro the issue :+1: We'll fix this, but in the meantime you can run helm with the --no-hooks flag to avoid triggering that failing Job. That job only adds some metadata into the linkerd-smi after it's created by helm. So to replace that, you can have your pipeline create the linkerd-smi namespace with the appropriate metadata:

apiVersion: v1
kind: Namespace
metadata:
  labels:
    kubernetes.io/metadata.name: linkerd-smi
    linkerd.io/extension: smi
    name: linkerd-smi
    pod-security.kubernetes.io/enforce: privileged
  name: linkerd-smi