Interview Q&A / Docker & Kubernetes

INTERVIEW Q&A · 67 QUESTIONS

Docker & Kubernetes interview questions

Images, containers, Dockerfiles, pods and deployments, from first principles.

  1. Does EXPOSE in a Dockerfile make a port reachable from outside?

    No. EXPOSE is only documentation of the port the app listens on. To make it reachable from the host you must publish it with -p, or -P to publish all exposed ports to random host ports.

    BeginnerQuick answer1 min read
  2. How can two Docker containers talk to each other?

    Put them on the same user-defined network and call one from the other using its container or service name and the container port. Publishing a port with -p is only needed for access from the host.

    BeginnerQuick answer1 min read
  3. What are the bridge, host and none network modes in Docker?

    bridge (default) gives a container its own network and IP behind a virtual switch, host shares the host's network stack with no isolation, and none disables networking except loopback.

    BeginnerQuick answer1 min read
  4. What are the different Service types in Kubernetes?

    ClusterIP exposes a Service only inside the cluster, NodePort opens a port on every node, LoadBalancer provisions a cloud load balancer, and ExternalName maps the Service to an external DNS name.

    BeginnerQuick answer1 min read
  5. What is an Ingress in Kubernetes and how does it differ from a LoadBalancer Service?

    An Ingress defines HTTP and HTTPS routing rules by host and path, handled by an Ingress controller. One load balancer can serve many services, while a LoadBalancer Service creates one external load balancer per Service.

    BeginnerQuick answer1 min read