Skip to content

Commit b889f97

Browse files
authored
Update README.md
Support for Kubernetes added
1 parent 3b3bbdd commit b889f97

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello World sample shows how to deploy [SpringBoot](http://projects.spring.io/spring-boot/) RESTful web service application with [Docker](https://www.docker.com/)
1+
Hello World sample shows how to deploy [SpringBoot](http://projects.spring.io/spring-boot/) RESTful web service application with [Docker](https://www.docker.com/) and with [Kubernetes](https://kubernetes.io/)
22

33
#### Prerequisite
44

@@ -11,6 +11,7 @@ Optional:
1111
[Java 1.8 or 11.1](https://www.oracle.com/technetwork/java/javase/overview/index.html)
1212
[Maven 3.x](https://maven.apache.org/install.html)
1313

14+
1415
#### Steps
1516

1617
##### Clone source code from git
@@ -70,3 +71,60 @@ Hello World
7071
```
7172
docker-compose down
7273
```
74+
75+
### Deploy under the Kuberenetes cluster
76+
77+
#### Prerequisite
78+
79+
##### MiniKube
80+
81+
Installed:
82+
[MiniKube](https://www.digitalocean.com/community/tutorials/how-to-use-minikube-for-local-kubernetes-development-and-testing)
83+
84+
Started:
85+
```
86+
minikube start
87+
```
88+
89+
90+
#### Retrieve and deploy application(hello-spring-boot)
91+
```
92+
kubectl create deployment hello-spring-boot --image=dstar55/docker-hello-world-spring-boot:latest
93+
```
94+
95+
#### Expose the deployment(hello-spring-boot) as a Kubernetes Service,
96+
```
97+
kubectl expose deployment hello-spring-boot --type=NodePort --port=8080
98+
```
99+
100+
#### Check whether the service(hello-spring-boot) is running
101+
```
102+
kubectl get service hello-spring-boot
103+
```
104+
105+
response should something like:
106+
```
107+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
108+
hello-spring-boot NodePort xx.xx.xxx.xxx <none> 8082:30619/TCP 59m
109+
```
110+
111+
#### Retrieve the URL for application(hello-spring-boot)
112+
```
113+
minikube service hello-spring-boot --url
114+
```
115+
116+
response will be http, e.g:
117+
```
118+
http://127.0.0.1:44963
119+
```
120+
121+
##### Test application with ***curl*** command(note: port is randomly created)
122+
123+
```
124+
$ curl 127.0.0.1:44963
125+
```
126+
127+
the respone should be:
128+
```
129+
Hello World
130+
```

0 commit comments

Comments
 (0)