Getting Started with Kubernetes 1.4 using Spring Boot and Couchbase

Kubernetes 1.4 was released earlier this week. Read the blog announcement and CHANGELOG. There are quite a few new features in this release but the key ones that I’m excited about are:

Install Kubernetes using kubeadm command. This is in addition to the usual mechanism of downloading from https://github.com/kubernetes/kubernetes/releases. The kubeadm init and kubeadm join commands looks very similar to docker swarm init and docker swarm join for Docker Swarm Mode.

This creates a Couchbase service and the backing replication controller. Name of the service is couchbase-service. This will be used later by the Spring Boot application to communicate with the database.

Check the status of pods:

1

2

3

4

5

6

7

kubectl.sh get-wpods

NAME READY STATUS RESTARTS AGE

couchbase-rc-gu9gl0/1ContainerCreating06s

NAME READY STATUS RESTARTS AGE

couchbase-rc-gu9gl1/1Running02m

Note, how the pod status changes from ContainerCreating to Running. The image is downloaded and started in the meanwhile.

This indicates that the JSON document is upserted (either inserted or updated) in the Couchbase database.

Kubernetes Dashboard

Kubernetes Dashboard is look more comprehensive and claimed to have 90% parity with the CLI. Use kubectl.sh config view command to view the configuration information about the cluster. It looks like:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

apiVersion:v1

clusters:

-cluster:

certificate-authority-data:REDACTED

server:https://52.40.9.27

name:aws_kubernetes

contexts:

-context:

cluster:aws_kubernetes

user:aws_kubernetes

name:aws_kubernetes

current-context:aws_kubernetes

kind:Config

preferences:{}

users:

-name:aws_kubernetes

user:

client-certificate-data:REDACTED

client-key-data:REDACTED

token:3GuTCLvFnINHed9dWICICidlrSv8C0kg

-name:aws_kubernetes-basic-auth

user:

password:8pxC121Oj7kN0nCa

username:admin

The clusters.cluster.server property value shows the location of Kubernetes master. The users property show two users that can be used to access the dashboard. Second one uses basic authentication and so copy the username and password property value. In our case, Dashboard UI is accessible at https://52.40.9.27/ui.

All the Kubernetes resources can be easily seen in this fancy dashboard.