DevOps, Infra

[skaffold] window 에 설치한 skaffold Trouble Shooting

seulseul 2022. 12. 29. 19:22

WSL 에 Skaffold 를 설치했을때 나타난 issue 입니다.

WSL 에 아래 명령어로 Skaffold 를 설치했다.

# skaffold 설치
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.0.0/skaffold-linux-amd64 
# skaffold 명령어를 모든 user 가 사용할수 있도록 이동
sudo install skaffold /usr/local/bin/
10:35:01 ubuntu@DESKTOP-BHD5HLL ~ → which skaffold
/usr/local/bin/skaffold


Global Skaffold Config File

10:35:00 ubuntu@DESKTOP-BHD5HLL .skaffold → pwd
/home/ubuntu/.skaffold

02:48:11 ubuntu@DESKTOP-BHD5HLL .skaffold → ll
total 80K
-rw-r--r-- 1 ubuntu ubuntu 2.3K Nov 21 14:48 cache
-rw-r--r-- 1 ubuntu ubuntu  163 Nov 21 14:42 config
-rw-r--r-- 1 ubuntu ubuntu  70K Nov 21 14:42 metrics
  • .skaffold directory 는 skaffold 의 config 및 cache 가 존재하는 폴더이다.
  • wsl 에 설치했기때문에 /home/ubuntu/.skffold 에 위치해있는 상황이었다.
  • skaffold 가 빌드할 코드 위치 : C:\\_DEV\\_edu\\03_demo_2\\demo-api
    • C 드라이브에 위치해있었다.
  • 문제점
    • window 의 파일구조와 skaffold config dir 불일치 때문에 소스 수정후 Hot Reload , Replica 수 변경등 skaffold 의 이점을 활용하지 못하고 있었다.

skaffold 가 빌드 할 코드를 skaffold 가 설치된 /home/ubuntu 경로에 copy 한후에 테스트해봤다.

# 코드 카피
cp -r /mnt/c/_DEV/_edu/03_demo_2/demo-api /home/ubuntu/demo-api

10:27:34 ubuntu@DESKTOP-BHD5HLL demo-api ±|main ✗|→ pwd
/home/ubuntu/demo-api

# code .
# 명령어 실행시 현재 위치를 기준으로 VS CODE IDE 를 OPEN
10:27:21 ubuntu@DESKTOP-BHD5HLL demo-api ±|main ✗|→ code .
Updating VS Code Server to version 6261075646f055b99068d3688932416f2346dd3b
Removing previous installation...
Installing VS Code Server for x64 (6261075646f055b99068d3688932416f2346dd3b)
Downloading: 100%
Unpacking: 100%
Unpacked 2457 files and folders to /home/ubuntu/.vscode-server/bin/6261075646f055b99068d3688932416f2346dd3b.

# skaffold dev 모드로 실행
skaffold dev -p dev -t v2

IDE (vs code) 에서 코드를 수정했을때 자동으로 1) 빌드, 2) 도커 푸시 , 3) Pod Reload 되는 것을 확인할 수 있다.

  • Spring Boot Log ( skaffold dev 로 실행했을때 로그 )
[demo-api] Hibernate:
[demo-api]     update
[demo-api]         board
[demo-api]     set
[demo-api]         mod_date=?,
[demo-api]         content=?,
[demo-api]         ins_id=?,
[demo-api]         hits=?,
[demo-api]         mod_id=?,
[demo-api]         subject=?
[demo-api]     where
[demo-api]         seq=?
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [1] as [TIMESTAMP] - [2022-11-21T05:47:21.287653]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [2] as [VARCHAR] - [test]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [3] as [VARCHAR] - [evelyn]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [4] as [INTEGER] - [158]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [5] as [VARCHAR] - [null]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [6] as [VARCHAR] - [test]
[demo-api] 05:47:21.288 [TRACE] [http-nio-8088-exec-2] o.h.type.descriptor.sql.BasicBinder - binding parameter [7] as [BIGINT] - [4]
Generating tags...
 - docker.io/jei0486/demo-api -> docker.io/jei0486/demo-api:v2
Checking cache...
 - docker.io/jei0486/demo-api: Not found. Building
Starting build...
Found [kind-kind] context, using local docker daemon.
Building [docker.io/jei0486/demo-api]...
Target platforms: [linux/amd64]
> Task :_skaffoldFailIfJibOutOfDate
> Task :compileJava
> Task :processResources UP-TO-DATE
> Task :classes

> Task :jib

Containerizing application to jei0486/demo-api:v2...
Base image 'openjdk:11.0.11-jre' does not use a specific image digest - build may not be reproducible
Getting manifest for base image openjdk:11.0.11-jre...
Building dependencies layer...
Building resources layer...
Building classes layer...
Building jvm arg files layer...
The credential helper (docker-credential-desktop.exe) has nothing for server URL: registry-1.docker.io

Got output:

credentials not found in native keychain

The credential helper (docker-credential-desktop.exe) has nothing for server URL: registry.hub.docker.com

Got output:

credentials not found in native keychain

The base image requires auth. Trying again for openjdk:11.0.11-jre...
The credential helper (docker-credential-desktop.exe) has nothing for server URL: registry-1.docker.io

Got output:

credentials not found in native keychain

Using credentials from Docker config (/home/ubuntu/.docker/config.json) for jei0486/demo-api:v2
The credential helper (docker-credential-desktop.exe) has nothing for server URL: registry.hub.docker.com

Got output:

credentials not found in native keychain

Using credentials from Docker config (/home/ubuntu/.docker/config.json) for openjdk:11.0.11-jre
Using base image with digest: sha256:50c85f8bc95c66f3eb1d8fd79cbf34e9cd509fe4cc584253e7566a832877b840

Container entrypoint set to [java, -cp, @/app/jib-classpath-file, com.demo.api.DemoApiApplication]

Built and pushed image as jei0486/demo-api:v2

BUILD SUCCESSFUL in 9s
4 actionable tasks: 3 executed, 1 up-to-date
Build [docker.io/jei0486/demo-api] succeeded
Tags used in deployment:
 - docker.io/jei0486/demo-api -> docker.io/jei0486/demo-api:v2@sha256:53fa107e36f60422f694b8bead28670725b26b6d6c80afa5a768345117501f17
Starting deploy...
Loading images into kind cluster nodes...
Images loaded in 55ns
 - deployment.apps/demo-api configured
Waiting for deployments to stabilize...
 - api:deployment/demo-api: creating container demo-api
    - api:pod/demo-api-784d54db66-vb597: creating container demo-api
 - api:deployment/demo-api: creating container demo-api
    - api:pod/demo-api-784d54db66-dvl7f: creating container demo-api
 - api:deployment/demo-api is ready.
Deployments stabilized in 17.059 seconds
Watching for changes...
[demo-api] 05:48:18.755 [INFO ] [http-nio-8088-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
[demo-api] 05:48:18.755 [INFO ] [http-nio-8088-exec-1] o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
[demo-api] 05:48:18.757 [INFO ] [http-nio-8088-exec-1] o.s.web.servlet.DispatcherServlet - Completed initialization in 1 ms
[demo-api] Hibernate: 
[demo-api]     select
[demo-api]         boardentit0_.seq as seq1_0_0_,
[demo-api]         boardentit0_.ins_date as ins_date2_0_0_,
[demo-api]         boardentit0_.mod_date as mod_date3_0_0_,
[demo-api]         boardentit0_.content as content4_0_0_,
[demo-api]         boardentit0_.ins_id as ins_id5_0_0_,
[demo-api]         boardentit0_.hits as hits6_0_0_,
[demo-api]         boardentit0_.mod_id as mod_id7_0_0_,
[demo-api]         boardentit0_.subject as subject8_0_0_
[demo-api]     from
[demo-api]         board boardentit0_
[demo-api]     where
[demo-api]         boardentit0_.seq=?
[demo-api] 05:48:18.832 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [1] as [BIGINT] - [4]
[demo-api] 05:48:18.845 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([ins_date2_0_0_] : [TIMESTAMP]) - [2022-11-17T15:44:50]
[demo-api] 05:48:18.845 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([mod_date3_0_0_] : [TIMESTAMP]) - [2022-11-21T05:47:21]
[demo-api] 05:48:18.846 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([content4_0_0_] : [VARCHAR]) - [test]
[demo-api] 05:48:18.846 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([ins_id5_0_0_] : [VARCHAR]) - [evelyn]
[demo-api] 05:48:18.846 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([hits6_0_0_] : [INTEGER]) - [158]
[demo-api] 05:48:18.846 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([mod_id7_0_0_] : [VARCHAR]) - [null]
[demo-api] 05:48:18.847 [TRACE] [http-nio-8088-exec-1] o.h.t.descriptor.sql.BasicExtractor - extracted value ([subject8_0_0_] : [VARCHAR]) - [test]
[demo-api] 05:48:18.902 [INFO ] [restartedMain] o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8088 (http)
[demo-api] Hibernate: 
[demo-api]     update
[demo-api]         board
[demo-api]     set
[demo-api]         mod_date=?,
[demo-api]         content=?,
[demo-api]         ins_id=?,
[demo-api]         hits=?,
[demo-api]         mod_id=?,
[demo-api]         subject=?
[demo-api]     where
[demo-api]         seq=?
[demo-api] 05:48:18.904 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [1] as [TIMESTAMP] - [2022-11-21T05:48:18.897084]
[demo-api] 05:48:18.905 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [2] as [VARCHAR] - [test]
[demo-api] 05:48:18.907 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [3] as [VARCHAR] - [evelyn]
[demo-api] 05:48:18.908 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [4] as [INTEGER] - [159]
[demo-api] 05:48:18.908 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [5] as [VARCHAR] - [null]
[demo-api] 05:48:18.909 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [6] as [VARCHAR] - [test]
[demo-api] 05:48:18.909 [TRACE] [http-nio-8088-exec-1] o.h.type.descriptor.sql.BasicBinder - binding parameter [7] as [BIGINT] - [4]
[demo-api] 05:48:18.917 [INFO ] [restartedMain] o.a.catalina.core.StandardService - Starting service [Tomcat]
[demo-api] 05:48:18.918 [INFO ] [restartedMain] o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.68]