One of the attendees from Kubernetes for Java Developers training suggested that I try minikube for simplified Kubernetes development and testing. This blog will show you how to get started with minikube using a simple Java application.


Minikube starts a single node Kubernetes cluster on your local machine for rapid development and testing. Requirements lists the exact set of requirements for different operating systems.

This blog will show:

  • How to start a one node Kubernetes cluster
  • Run a Couchbase service
  • Run a Java application
  • View the Kubernetes Dashboard

All the Kubernetes resource description files used in this blog are at

Start Kubernetes Cluster using Minikube

Create a new directory with the name minikube.

In that directory, download kubectl CLI:

curl -Lo kubectl && chmod +x kubectl

Download minikube CLI:

curl -Lo minikube && chmod +x minikube

Start the cluster:

minikube start
Starting local Kubernetes cluster...
Kubectl is now configured to use the cluster.

The list of nodes can be seen:

kubectl get nodes
minikube   Ready     2h

More details about the cluster can be obtained using the kubectl cluster-info command:

kubectl cluster-info
Kubernetes master is running at
kubernetes-dashboard is running at

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Behind the scenes, a Virtual Box VM is started.

The complete set of commands supported can be seen by using --help:

minikube --help
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows.

  minikube [command]

Available Commands:
  dashboard        Opens/displays the kubernetes dashboard URL for your local cluster
  delete           Deletes a local kubernetes cluster.
  docker-env       sets up docker env variables; similar to '$(docker-machine env)'
  get-k8s-versions Gets the list of available kubernetes versions available for minikube.
  ip               Retrieve the IP address of the running cluster.
  logs             Gets the logs of the running localkube instance, used for debugging minikube, not user code.
  config           Modify minikube config
  service          Gets the kubernetes URL for the specified service in your local cluster
  ssh              Log into or run a command on a machine with SSH; similar to 'docker-machine ssh'
  start            Starts a local kubernetes cluster.
  status           Gets the status of a local kubernetes cluster.
  stop             Stops a running local kubernetes cluster.
  version          Print the version of minikube.

      --alsologtostderr[=false]: log to standard error as well as files
      --log-flush-frequency=5s: Maximum number of seconds between log flushes
      --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
      --log_dir="": If non-empty, write log files in this directory
      --logtostderr[=false]: log to standard error instead of files
      --show-libmachine-logs[=false]: Whether or not to show logs from libmachine.
      --stderrthreshold=2: logs at or above this threshold go to stderr
      --v=0: log level for V logs
      --vmodule=: comma-separated list of pattern=N settings for file-filtered logging

Use "minikube [command] --help" for more information about a command.

Run a Couchbase Service

Create a Couchbase service:

kubectl create -f couchbase-service.yml 
service "couchbase-service" created
replicationcontroller "couchbase-rc" created

This will start a Couchbase service. The service is using the pods created by the replication controller. The replication controller creates a single node Couchbase server.

The configuration file is at and looks like:

apiVersion: v1
kind: Service
  name: couchbase-service
    app: couchbase-rc-pod
    - name: admin
      port: 8091
    - name: views
      port: 8092
    - name: query
      port: 8093
    - name: memcached
      port: 11210
apiVersion: v1
kind: ReplicationController
  name: couchbase-rc
  replicas: 1
        app: couchbase-rc-pod
      - name: couchbase
        image: arungupta/oreilly-couchbase
        - containerPort: 8091
        - containerPort: 8092
        - containerPort: 8093
        - containerPort: 11210

Run the Java Application

Run the application:

kubectl create -f bootiful-couchbase.yml 
job "bootiful-couchbase" created

The configuration file is at and looks like:

apiVersion: batch/v1
kind: Job
  name: bootiful-couchbase
    name: bootiful-couchbase-pod
      name: bootiful-couchbase-pod
      - name: bootiful-couchbase
        image: arungupta/bootiful-couchbase
        - name: COUCHBASE_URI
          value: couchbase-service
      restartPolicy: Never

This is run-once job which runs a Java (Spring Boot) application and upserts (insert or update) a JSON document in Couchbase.

In this job, COUCHBASE_URI environment variable value is set to couchbase-service. This is the service name created earlier. The Docker image used for this service is arungupta/bootiful-couchbase and is created using fabric8-maven-plugin as shown at Specifically, the command for the Docker image is:

java -Dspring.couchbase.bootstrap-hosts=$COUCHBASE_URI -jar /maven/${project.artifactId}.jar

This ensures that the COUCHBASE_URI environment variable is overriding spring.couchbase.bootstrap-hosts property as defined in of the Spring Boot application.

Kubernetes Dashboard

Kubernetes 1.4 included an updated dashboard. For minikube, this can be opened using the following command:

minikube dashboard
Waiting, endpoint for service is not ready yet...Opening kubernetes dashboard in default browser...


The default view is shown below:

But in our case, a few resources have already been created and so this will look like this:


Notice, our Jobs, Replication Controllers and Pods are shown here.

Shutdown Kubernetes Cluster

The cluster can be easily shutdown:

minikube stop
Stopping local Kubernetes cluster...
Machine stopped. provide more details about running Couchbase using different orchestration frameworks. Further references:

Minikube – Rapid Dev & Testing for Kubernetes

| Cloud| 1,472 views | 0 Comments
About The Author
- Arun Gupta is the vice president of developer advocacy at Couchbase. He has been building developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of a best-selling book, an avid runner, a globe trotter, a Java Champion, and a JUG leader, he is easily accessible at @arungupta.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>