突っ走り書き

見せるほどのものでは..

「Deploy your Spring Boot Application to a local Kubernetes Cluster」をやった

k8s なにもわからんを卒業するべく、まずは触ってみた。

www.youtube.com

デプロイした Spring Application は動画で紹介されているこちら:

github.com

動画との変更点

ローカルに立てる docker registry のポートを 5000 から5001 に変更して試した(DisplayLink が 5000 を使っていたので)。

diff --git a/deploy-spring-boot-to-local-k8s/deployment.yml b/deploy-spring-boot-to-local-k8s/deployment.yml
index 3d069ec..86b6101 100644
--- a/deploy-spring-boot-to-local-k8s/deployment.yml
+++ b/deploy-spring-boot-to-local-k8s/deployment.yml
@@ -14,7 +14,7 @@ spec:
     spec:
       containers:
         - name: spring-boot-app
-          image: localhost:5000/spring-boot-app
+          image: localhost:5001/spring-boot-app
           imagePullPolicy: Always
           ports:
             - containerPort: 8080

起動できた

i@ainoMacBook-Air deploy-spring-boot-to-local-k8s % kubectl get pods                                     
NAME                               READY   STATUS    RESTARTS   AGE
spring-boot-app-5c5546c4c9-62qkp   1/1     Running   0          5m56s
spring-boot-app-5c5546c4c9-77l9r   1/1     Running   0          6m6s
i@ainoMacBook-Air deploy-spring-boot-to-local-k8s % curl http://localhost:31000/actuator/health
{"status":"UP"}

i@ainoMacBook-Air deploy-spring-boot-to-local-k8s % curl http://localhost:31000/api/messages   
["Hello","from","Kubernetes"]