Kubernetes getting started locally with docker

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

I have the docker container pulled and I have a kubectl available.

  • how to package a docker image in a single file
  • can we update docker default configure?
  • Difficulty accessing Docker's API
  • Why got connection refused of the swarm leader during round robin of services
  • Store docker machine in D: drive rather than in C:\Users\… windows 7
  • Cannot authenticate to Docker in Elastic Beanstalk through S3
  • When I run the command kubectl get nodes --show-labels I get the following

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

    I now create a new service with kubectl run nginx --image=nginx --port=80 as per the docs. When I run docker ps I see a container that’s been created using my local nginx:latest 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’m having problems kubectl expose rc nginx --port=80 is supposed to expose the nginx image as a kubernetes service on port 80.

    I get this in the terminal.

    Error from server: replicationcontrollers “nginx” not found

    So I started reading about replicationcontrollers, I understand the concepts but I do not know how they are configured or setup. This got me to thinking that I’m following what should be an idiot proof setup guide. Can anyone help me with this? I have added my docker and kubernetes versions below.

    Version info

    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
    

    Kubernetes version

    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"
    }
    

  • Docker: how to set up file ownership in a data-only container?
  • Forward local SSH credentials to Docker container inside Vagrant VM
  • expose docker containers application port to host on windows using boot2docker
  • Docker build times long with npm global install angular-cli
  • How to run meanstack in docker
  • docker & Quagga BGP
  • 2 Solutions collect form web for “Kubernetes getting started locally with docker”

    Kubernetes documentation for docker is outdated for now. Some elements need to be added.

    This kubernetes issue is the one to follow.

    You can find at this comment the answer to setup. It’s working for me with DNS/Dashboard addons. I have not done a complete test of all the features but complexe application are running on it (understand not helloworld application).

    If you are interested, you can find some project that try to solve this setup that is not so trivial if you don’t have time:

    • hive
    • kmachine

    Note I don’t put any setup here as it will certainly be outdated soon … Kubernetes documentation is the good place (and for now the issue I pointed you to ^^)

    If you want to run Kubernetes on top of Docker have a look at Kubernetes Anywhere. They say:

    All you need is one or more Docker hosts.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.