Kubernets start working with docker

I am trying to configure Kubernetes locally using a docker instance. I am following this documentation but am stuck at the point of creating a new service and exposing ports.

I have a docker container and I have kubectl .

When I run the kubectl get nodes --show-labels command, I get the following

  | NAME |  STATUS |  AGE |  LABELS |
 | ----------- | --------- | -------- | ------------------ -------------------- |
 | 127.0.0.1 |  Ready |  1h |  kubernetes.io/hostname=127.0.0.1 |

Now I am creating a new service with kubectl run nginx --image=nginx --port=80 according to the docs. When I start docker ps , I see a container that was created using my local nginx: last image.

  CONTAINER_ID: 4192d1b423ec        
 IMAGE: nginx
 COMMAND: "nginx -g 'daemon off'"
 CREATED: 37 minutes ago
 STATUS: Up 37 minutes                           
 NAMES: k8s_nginx.aab52821_nginx-198147104-qop91_default_f1cf5d8a-ef2d-11e5-b527-f0def1de109f_940ee216

The next step is where I have problems. kubectl expose rc nginx --port=80 should show the nginx image as a kubernetes service on port 80.

I get this in the terminal.

Server error : nginx replication controllers not found

So, I started reading about replication controllers, I understand the concepts, but I don't know how they are configured or configured. It made me think that I was following what should be a guide to setting up idiots. Can anyone help me with this? I have added my versions of dockers and kubernetes below.

Version Information

Docker Version (Local Ubuntu 15.10)

  Client:
  Version: 1.10.3
  API version: 1.22
  Go version: go1.5.3
  Git commit: 20f81dd
  Built: Thu Mar 10 15:59:07 2016
  OS / Arch: linux / amd64

 Server:
  Version: 1.10.3
  API version: 1.22
  Go version: go1.5.3
  Git commit: 20f81dd
  Built: Thu Mar 10 15:59:07 2016
  OS / Arch: linux / amd64

version of Kubernete

  Client Version: version.Info {
     Major: "1", 
     Minor: "2", 
     GitVersion: "v1.2.0",
     GitCommit: "5cb86ee022267586db386f62781338b0483733b3",
     GitTreeState: "clean"
 }

 Server Version: version.Info {
     Major: "1",
     Minor: "2",
     GitVersion: "v1.2.0",
     GitCommit: "5cb86ee022267586db386f62781338b0483733b3",
     GitTreeState: "clean"
 }
+5
source share
2 answers

The Kubernetes documentation for dockers is already out of date. Some elements need to be added.

This question of the kubernets is the one that follows it.

You can find the installation response in this comment . It works for me with DNS / Dashboard add-ons. I did not pass a full check of all the functions, but a complex application is working on it (do not understand the helloworld application).

If you are interested, you can find some project that will try to solve this setting, which is not so trivial if you do not have time:

Note. I am not setting any settings here, as this will become obsolete soon ... Kubernetes documentation is a good place (and at the moment I pointed you to ^^)

+1
source

If you want to run Kubernetes on top of Docker , see Kubernetes anywhere . They speak:

All you need is one or more Docker hosts.

0
source

Source: https://habr.com/ru/post/1245459/


All Articles