kuberneteskubernetes-helmhelmfile

Helm installation command: connection reset by peer


When I run helm install for the first time for any package installation with ansible, it throws the below error (example for cert-manager). But it vanishes again after executing the second time. I think it's because it installs the requested package and skips installation. I don't have any network issue. Can someone help what's wrong in my configuration?

fatal: [test1.inficare.local]: FAILED! => {"changed": true, "cmd": "helm upgrade -i cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.13.3 --set installCRDs=true", "delta": "0:01:18.099395", "end": "2024-10-18 16:21:29.539201", "msg": "non-zero return code", "rc": 1, "start": "2024-10-18 16:20:11.439806", "stderr": "WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/administrator/.kube/config\nWARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/administrator/.kube/config\nError: failed post-install: Delete \"https://10.21.146.15:6443/apis/rbac.authorization.k8s.io/v1/namespaces/cert-manager/roles/cert-manager-startupapicheck:create-cert\": write tcp 10.21.146.245:43004->10.21.146.15:6443: write: connection reset by peer", "stderr_lines": ["WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/administrator/.kube/config", "WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/administrator/.kube/config", "Error: failed post-install: Delete \"https://10.21.146.15:6443/apis/rbac.authorization.k8s.io/v1/namespaces/cert-manager/roles/cert-manager-startupapicheck:create-cert\": write tcp 10.21.146.245:43004->10.21.146.15:6443: write: connection reset by peer"], "stdout": "Release \"cert-manager\" does not exist. Installing it now.", "stdout_lines": ["Release \"cert-manager\" does not exist. Installing it now."]}

I was expecting helm install command would go smoothly but it throws an error. However after running the same command second time, it does not throw any error.


Solution

  • Just a workaround, you can add retries to your ansible playbook

    - name: Install cert-manager using Helm
      command: >
        helm upgrade -i cert-manager jetstack/cert-manager
        --namespace cert-manager --create-namespace
        --version v1.13.3 --set installCRDs=true
      retries: 3
      delay: 10
      register: helm_result
      until: helm_result.rc == 0