• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
Kubernetes | Hello Minikube
  1. Notes
  2. Create a deployment (default namespace)
  3. Create a service (default namespace)
  4. Expose the URL for a service using the minikube service command
  5. Expose the LoadBalancer external IP address using the minikube tunnel command
  6. Mount a host directory into Minikube using the minikube mount command

  1. Notes
    Please visit this page for more details on how to use MiniKube: https://kubernetes.io/docs/tutorials/hello-minikube/
  2. Create a deployment (default namespace)
    • Create a deployment:

    • View the deployment:

    • View the pod:

    • View the deployment's events:
  3. Create a service (default namespace)
    • Create a service:

    • View the service:
  4. Expose the URL for a service using the minikube service command
    • Run the following command to expose the service (this will launch a browser and open the service's URL):

      If you are using a remote shell to access Minikube's server, use the option --url=true to display the Kubernetes service URL instead of opening it in the browser:

    • Check the service endpoint:
  5. Expose the LoadBalancer external IP address using the minikube tunnel command
    Services of type LoadBalancer can be exposed using the minikube tunnel command:

    Check the external IP of the LoadBalancer:

    The external IP is exposed on the Minikube's host:

    The minikube tunnel command should be kept running in a terminal window to keep the external IP of the LoadBalancer exposed. You can enter Ctrl-C to stop exposing the external IP and clean up the network routes. This will also clean up the file ~/.minikube/tunnels.json file:

    In some cases, if Ctrl-C didn't work properly, you can force cleaning up all orphaned routes left in ~/.minikube/tunnels.json file file:
  6. Mount a host directory into Minikube using the minikube mount command
    minikube mount usage:

    To allow containers running in Minikube to read/write from/into the host directory, you have to set properly the following options uid, gid, mode.

    Let's say the current user in the host has the uid "1000" and gid "1000":

    Let's also say that the Dockerfile is running using the same uid and gid of the host's user:

    To mount a local directory from the host into the Minikube, you use the following command:
© 2025  mtitek