<p>I'm new to Kubernetes so I encountered the following issue. These are my steps:</p>

<p>1) I ran <code>etcd</code>:</p>

<pre><code>docker run --volume=/var/etcd:/var/etcd --net=host -d gcr.io/google_containers/etcd:2.0.12 /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data
</code></pre>

<p>2) I ran the master container:</p>

<pre><code>docker run \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:ro \
--volume=/dev:/dev \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
--volume=/var/run:/var/run:rw \
--net=host \
--pid=host \
--privileged=true \
-d gcr.io/google_containers/hyperkube:v1.0.1 \
/hyperkube kubelet --containerized --hostname-override="127.0.0.1" --address="0.0.0.0" --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests
</code></pre>

<p>3) I ran the proxy:</p>

<pre><code>docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
</code></pre>

<p>4) I installed <code>kubectl</code></p>

<p>5) I created this simple <code>pod-file.yml</code>:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: two-containers
spec:

  restartPolicy: Never

  volumes:
  - name: shared-data
    emptyDir: {}

  containers:

  - name: nginx-container
    image: nginx
    volumeMounts:
    - name: shared-data
      mountPath: /usr/share/nginx/html

  - name: debian-container
    image: debian
    volumeMounts:
    - name: shared-data
      mountPath: /pod-data
    command: ["/bin/sh"]
    args: ["-c", "echo Hello from the debian container &gt; /pod-data/index.html"]
</code></pre>

<p>and tried to create pod by running:</p>

<pre><code>kubectl create -f pod-file.yml
</code></pre>

<p>And I got:</p>

<pre><code>ubuntu@ubuntu:~$ kubectl create -f pod-file.yml
error: could not read an encoded object from pod-file.yml: unable to connect to a server to handle "pods": couldn't read version from server: Get http://localhost:8080/api: dial tcp 127.0.0.1:8080: connection refused
</code></pre>

<p>I found it pretty odd so I checked containers I ran earlier:</p>

<pre><code>ubuntu@ubuntu:~$ docker ps
CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS                                                                           PORTS               NAMES
3ae7f094bb01        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube proxy ..."   55 minutes ago      Up 55 minutes                                                                                        suspicious_ramanujan
ed841bc6ef26        gcr.io/google_containers/hyperkube:v1.0.1   "/hyperkube kubele..."   57 minutes ago      Up 57 minutes                                                                                        competent_mclean
7408c640a2c8        gcr.io/google_containers/etcd:2.0.12        "/usr/local/bin/et..."   About an hour ago   Up About an hour                                                                                     elated_shaw
</code></pre>

<p>So looks like all is ok because all containers are up and running. Okay, I checked open ports in my system (<code>ubuntu 16.04</code>):</p>

<pre><code>ubuntu@ubuntu:~$ sudo netstat -nautp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1315/sshd
tcp        0      0 127.0.0.1:7001          0.0.0.0:*               LISTEN      3209/etcd
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      3324/hyperkube
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      3399/hyperkube
tcp        0      0 127.0.0.1:2380          0.0.0.0:*               LISTEN      3209/etcd
tcp        0    524 172.30.3.114:22         212.98.179.158:35900    ESTABLISHED 3087/sshd: ubuntu [
tcp6       0      0 :::10255                :::*                    LISTEN      3324/hyperkube
tcp6       0      0 :::22                   :::*                    LISTEN      1315/sshd
tcp6       0      0 :::4001                 :::*                    LISTEN      3209/etcd
tcp6       0      0 :::10250                :::*                    LISTEN      3324/hyperkube
udp        0      0 0.0.0.0:68              0.0.0.0:*                           959/dhclient
udp        0      0 0.0.0.0:68              0.0.0.0:*                           796/dhclient
</code></pre>

<p>And I found that there is no <code>8080</code> open TCP port that <code>kubectl</code> tried to reach. So this is the cause of my issue. </p>

<p>So my question is what container/service/daemon I should run/launch to open this port and to assign web service to it in order to let kubectl use it for this GET request <code>http://localhost:8080/api</code>? </p>

<p>Any help would be appreciated.</p>

<p>Creating a <a href="https://kubernetes.io/docs/getting-started-guides/scratch/" rel="nofollow noreferrer">kubernetes cluster from scratch</a> is a little more complicated. The master <code>kubelet</code> runs a <a href="https://kubernetes.io/docs/getting-started-guides/scratch/#apiserver-controller-manager-and-scheduler" rel="nofollow noreferrer">number of pods</a> to make it all go. </p>

<p>If you're looking for an all in one solution use <a href="https://kubernetes.io/docs/getting-started-guides/minikube/" rel="nofollow noreferrer">minikube</a> to run in a VM. Otherwise use <a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="nofollow noreferrer"><code>kubeadm</code></a> to setup your master and work back from there if you want to see how each component is setup. </p>
