<p>Created a local cluster using <strong>Vagrant</strong> + <strong>Ansible</strong> + <strong>VirtualBox</strong>. Manually deploying works fine, but when using <strong>Helm</strong>:</p>

<pre><code>:~$helm install stable/nginx-ingress --name nginx-ingress-controller --set rbac.create=true
Error: forwarding ports: error upgrading connection: error dialing backend: dial tcp 10.0.52.15:10250: i/o timeout
</code></pre>

<p>Kubernetes cluster info:</p>

<pre><code>:~$kubectl get nodes,po,deploy,svc,ingress --all-namespaces -o wide
NAME                        STATUS   ROLES    AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
node/ubuntu18-kube-master   Ready    master   32m   v1.13.3   10.0.51.15    &lt;none&gt;        Ubuntu 18.04.1 LTS   4.15.0-43-generic   docker://18.6.1
node/ubuntu18-kube-node-1   Ready    &lt;none&gt;   31m   v1.13.3   10.0.52.15    &lt;none&gt;        Ubuntu 18.04.1 LTS   4.15.0-43-generic   docker://18.6.1

NAMESPACE     NAME                                               READY   STATUS    RESTARTS   AGE     IP           NODE                   NOMINATED NODE   READINESS GATES
default       pod/nginx-server                                   1/1     Running   0          40s     10.244.1.5   ubuntu18-kube-node-1   &lt;none&gt;           &lt;none&gt;
default       pod/nginx-server-b8d78876d-cgbjt                   1/1     Running   0          4m25s   10.244.1.4   ubuntu18-kube-node-1   &lt;none&gt;           &lt;none&gt;
kube-system   pod/coredns-86c58d9df4-5rsw2                       1/1     Running   0          31m     10.244.0.2   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/coredns-86c58d9df4-lfbvd                       1/1     Running   0          31m     10.244.0.3   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/etcd-ubuntu18-kube-master                      1/1     Running   0          31m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-apiserver-ubuntu18-kube-master            1/1     Running   0          30m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-controller-manager-ubuntu18-kube-master   1/1     Running   0          30m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-flannel-ds-amd64-jffqn                    1/1     Running   0          31m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-flannel-ds-amd64-vc6p2                    1/1     Running   0          31m     10.0.52.15   ubuntu18-kube-node-1   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-proxy-fbgmf                               1/1     Running   0          31m     10.0.52.15   ubuntu18-kube-node-1   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-proxy-jhs6b                               1/1     Running   0          31m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/kube-scheduler-ubuntu18-kube-master            1/1     Running   0          31m     10.0.51.15   ubuntu18-kube-master   &lt;none&gt;           &lt;none&gt;
kube-system   pod/tiller-deploy-69ffbf64bc-x8lkc                 1/1     Running   0          24m     10.244.1.2   ubuntu18-kube-node-1   &lt;none&gt;           &lt;none&gt;

NAMESPACE     NAME                                  READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS     IMAGES                                  SELECTOR
default       deployment.extensions/nginx-server    1/1     1            1           4m25s   nginx-server   nginx                                   run=nginx-server
kube-system   deployment.extensions/coredns         2/2     2            2           32m     coredns        k8s.gcr.io/coredns:1.2.6                k8s-app=kube-dns
kube-system   deployment.extensions/tiller-deploy   1/1     1            1           24m     tiller         gcr.io/kubernetes-helm/tiller:v2.12.3   app=helm,name=tiller

NAMESPACE     NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)         AGE   SELECTOR
default       service/kubernetes      ClusterIP   10.96.0.1      &lt;none&gt;        443/TCP         32m   &lt;none&gt;
default       service/nginx-server    NodePort    10.99.84.201   &lt;none&gt;        80:31811/TCP    12s   run=nginx-server
kube-system   service/kube-dns        ClusterIP   10.96.0.10     &lt;none&gt;        53/UDP,53/TCP   32m   k8s-app=kube-dns
kube-system   service/tiller-deploy   ClusterIP   10.99.4.74     &lt;none&gt;        44134/TCP       24m   app=helm,name=tiller
</code></pre>

<p>Vagrantfile:</p>

<pre><code>...

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
  $hosts.each_with_index do |(hostname, parameters), index|
    ip_address = "#{$subnet}.#{$ip_offset + index}"

    config.vm.define vm_name = hostname do |vm_config|
      vm_config.vm.hostname = hostname
      vm_config.vm.box = box
      vm_config.vm.network "private_network", ip: ip_address

      vm_config.vm.provider :virtualbox do |vb|        
        vb.gui = false
        vb.name = hostname
        vb.memory = parameters[:memory]
        vb.cpus = parameters[:cpus]
        vb.customize ['modifyvm', :id, '--macaddress1', "08002700005#{index}"]
        vb.customize ['modifyvm', :id, '--natnet1', "10.0.5#{index}.0/24"]
      end
    end
  end
end
</code></pre>

<p>Workaround for <strong>VirtualBox</strong> issue: set diffenrent <strong>macaddress</strong> and <strong>internal_ip</strong>.</p>

<p>It is interesting to find a solution that can be placed in one of the configuration files: vagrant, ansible roles. Any ideas on the problem?</p>

EnjoyLife
<blockquote>
  <p><code>Error: forwarding ports: error upgrading connection: error dialing backend: dial tcp 10.0.52.15:10250: i/o timeout</code></p>
</blockquote>

<p>You're getting bitten by a very common kubernetes-on-Vagrant bug: the kubelet believes its IP address is <code>eth0</code>, which is the <strong>NAT</strong> interface in Vagrant, versus using (what I hope you have) <a href="https://github.com/kubernetes-sigs/kubespray/blob/v2.8.2/Vagrantfile#L161" rel="nofollow noreferrer">the <code>:private_address</code> network</a> in your <code>Vagrantfile</code>. Thus, since all kubelet interactions happen directly to it (and not through the API server), things like <code>kubectl exec</code> and <code>kubectl logs</code> will fail in exactly the way you see.</p>

<p>The solution is to force kubelet to bind to the private network interface, or I guess you could switch your <code>Vagrantfile</code> to use the <a href="https://www.vagrantup.com/docs/networking/public_network.html#default-network-interface" rel="nofollow noreferrer">bridge network</a>, if that's an option for you -- just so long as the interface isn't the NAT one.</p>
