kubectl exec fails with TLS handshake error

5/11/2018

Kubernetes v1.9.4 && Docker v1.12.5

Have set up a master node, and 3 worker nodes. Created a pod on one of the worker nodes. yaml file follows -

    apiVersion: v1
    kind: Pod
    metadata:
      name: host
      labels:
        env: test
    spec:
       volumes:
       - name: data
         emptyDir: {}
       - name: supersecret
         secret:
             secretName: mysecret
       containers:
       - name: host
        image: 10.180.26.22:5000/new:2.6.2
        imagePullPolicy: Always
        command: ["/bin/sh"]
        args: ["-c","while true; do echo hello; sleep 10; done"]
        volumeMounts:
            - mountPath: /scratch
               name: data
            - mountPath: /var/run/secrets/super
               name: supersecret
       nodeSelector:
        childnode: host

The pod is created.

# kubectl get pod host

NAME       READY     STATUS    RESTARTS   AGE
host   1/1       Running   0          12m

When I try to get a shell inside the running container, it fails

# kubectl exec -it host -- /bin/bash

error: error sending request: Post https://10.184.154.321:6443/api/v1/namespaces/default/pods/host/exec?command=%2Fbin%2Fbash&container=host&container=host&stdin=true&stdout=true&tty=true: tls: first record does not look like a TLS handshake

I believe it is a proxy issue but I have set http_proxy as well as https_proxy flags according to my network and have used the same in setting up the entire setup.

-- Raj Dosi
docker
kubectl
kubernetes
proxy

0 Answers