access docker container in kubernetes

I have a docker container with an application exposing port 8080.
I can run it and access it on my local computer:

$ docker run -p 33333:8080 foo
* Running on (Press CTRL+C to quit) 

I can test it with:

  • Custom fonts in rrdgraph in a Docker container running Alpine Linux
  • How to set up WebStorm with Docker debug configurations?
  • Docker compose Invalid volume destination path: '.' mount path must be absolute
  • How to add user with dockerfile?
  • Mount 'pwd' in swarm service using Docker for Mac
  • Docker-Compose Postgresql import dump
  • $ nc -v locahost 33333
    connection succeeded!

    However when I deploy it in Kubernetes it doesn’t work.
    Here is the manifest file:

    apiVersion: v1
    kind: Pod
      name: foo-pod
      namespace: foo
        name: foo-pod
      - name: foo
        image: bar/foo:latest
        - containerPort: 8080


    apiVersion: v1
    kind: Service
      name: foo-service
      namespace: foo
      type: NodePort
        - port: 8080
        - NodePort: 33333
        name: foo-pod

    Deployed with:

    $ kubectl apply -f foo.yaml 
    $ nc -v <publicIP> 33333
    Connection refused 

    I don’t understand why I cannot access it…

  • boot2docker vm forgets changes when restarted
  • New install of Docker Toolbox yields “AppleEvent timed out.” error
  • Docker install causes host machine to be unreachable
  • Gradle clean task with bmuschko/gradle-docker-plugin
  • docker - change default login user
  • docker-compose build doesn't re-create some slices of my container, resulting in partially obsolete code
  • One Solution collect form web for “access docker container in kubernetes”

    The problem was that the application was listening on IP
    It needs to listen on to work in kubernetes. A change in the application code did the trick.

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