Running kubectl get nodes --kubeconfig /root/.kube/<your-kubernetes-cluster-kubeconfig-file> from inside the deployment container sometimes hangs.

Follow the procedure to resolve this:
  1. Ensure that, you have the right KUBECONFIG file on your deployment container using command:
    1. ls /root/.kube/<your-kubernetes-cluster-kubeconfig-file>
    2. If does not present, verify it is present on your deployment host/VM, using command:
      ls $HOME/.kube/<your-kubernetes-cluster-kubeconfig-file>
  2. Verify the IP address of the Kubernetes API server is reachable from your deployment host/VM:
    1. Get the IP address of the server from the KUBECONFIG file and ping the IP address:
      apiVersion: v1
      clusters:
      - cluster:
          certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1EUXhPREl6TXpZMU1sb1hEVE15TURReE5USXpNelkxTWxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBS1RlCmcvcFNaVG0wdnNiU2g2RFlZazJ1ZFRtZW51VytTdGNDV0RPb2NUYk1YbDBrclh0S2lDQ0R2UWdlTlVoT3RRZ0UKU2VPUzRnZEcweXJvSkswY09qMndjSHVlc0E3bGVYOVNxZUpacklhYUlUZTh5eEVtckJPbHVOZjdhdUhoS2UwYgprNFQwSlZja2F1T2VxTDB0YmQ0UTE1T2F4SS9VOEIyc2I5VTNvS1oxWUhQNlNWS05rWUthVjFFS1AxYXoxWjg1CmJnVTIzbS9KUy9URGR1aXV1aVkrU3lJd2c4dW1VSXlvbVBLbzFRU1RSblRmK2haSDduUEk1aEhwK2dtdXpudUYKK0NuWDNqQmgxcUpSenhLNkxiMGRITWZHT2NwbExsYTg1eTJDcTBVd3BQdmwzcDZIUkswZFdjcnhuSE1wMzNuOApIb0FnS3NRK0Q5NVV3QllzeThFQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZIOWJnMzMySXhWNTdNZ0FlbmxYYmxyRGhlenBNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFBb2NZRHFvblRyR0RVTExtZkpFRUt4dHVPdWdwd1VaWFo5QXBNdnNNNFJBR09FbG1DaQpTOTdtQU15dkE2dndjQlZDL3BOaXNIditaSGdJbHF4UWJJMXptWnJGb0g2bkE4Q1BCN2VwcDAxbFlvVEsxOGxOClNyN0ZyNlZMRlVYcWNsaFhKYndDNDVWVm4zYk9OQ2pobGFLV0pzV0hsNDBGV0RwNllmYnhWbzVQa0FEQjhGYUgKY3p1Q0pab3VXUGJ1R2M5VjBuOVB2dG1wbVh6NG1rS2xwaTlVTlF4TGx2bWtDRVlVYW1Na1Y2QzlxQ3pDSkp6bwowbzdDN3FHc2RZR0Q1d3VqY2JFSEE5a2ZVek9kSFRBalBrYmw5RUQyUGFCdFlONHJaT1h4L3RwaW94N3BYRjBzCjR2bTFuc3VLK2FFT2pwSHRoV25WQm4zTmkzb0VhZENsSGxuSwotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
          server: https://10.180.13.14:6443  <- Ping this server IP from the deployment host
    2. If the IP address is not reachable through ping, there may be connectivity issues between your deployment VM and the Kubernetes cluster. Contact IT administrator for resolution.
  3. If the IP address is reachable but the kubectl command still hangs inside the container, exit and relaunch the container with the --network host option:
    $ docker run \
        --rm \
        -v ${TCSA_WORK_SPACE}/tcx-deployer:/root/tcx-deployer \
        -v $HOME/.ssh:/root/.ssh \
        -v $HOME/.kube:/root/.kube \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -v $(which docker):/usr/local/bin/docker:ro \
        -v $HOME/.docker/config.json:/root/.docker/config.json:ro \
        -v /etc/docker:/etc/docker:rw \
        --network host \
        -it $DEPLOYMENT_IMAGE \
        bash
    1. Then rerun the kubectl get nodes --kubeconfig /root/.kube/<your-kubernetes-cluster-kubeconfig-file> command. If it still hangs there may be more fundamental connectivity issues between your deployment VM and the Kubernetes cluster. Contact IT admin for resolution.