์•ˆ๋…•ํ•˜์„ธ์š”,
์ด ํฌ์ŠคํŒ…์€ ๋‹ค์Œ ์›๋ฌธ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ž‘์„ฑํ•œ ํฌ์ŠคํŒ…์ž…๋‹ˆ๋‹ค.

์›๋ฌธ ์ €์ž
Jesse Antoszyk, Software Engineer with IBM Cloud.
Adam King, Senior Software Engineer with IBM Cloud.

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” Kubernetes์˜ Pod ์™€ Watson Conversation ์„œ๋น„์Šค๋ฅผ ์—ฐ๋™ํ•˜๋Š” ํŠœํ† ๋ฆฌ์–ผ์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.
๋„ค์ดํ‹ฐ๋ธŒ Kubernetes๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋Š” IBM Cloud Container Service๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Kubernetes ํ™˜๊ฒฝ์„ ๋น ๋ฅด๊ฒŒ ๊ตฌ์„ฑํ•˜๊ณ ,
์ƒ์„ฑ๋œ Pod ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ Watson Conversation ์„œ๋น„์Šค๋ฅผ ์—ฐ๋™ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

[์ค€๋น„์‚ฌํ•ญ]

  1. Bluemix Container Service ์ปค๋งจ๋“œ๋ผ์ธ ์„ค์น˜

    1. ์ตœ์‹  Bluemix CLI ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜ Bluemix CLI
    2. Bluemix์— ๋กœ๊ทธ์ธ
      bx login
    3. Container Service ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜
      bx plugin install container-service -r Bluemix
    4. container-service ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜ ์—ฌ๋ถ€ ํ™•์ธ
      bluemix plugin list
    5. Container Service ํ”Œ๋Ÿฌ๊ทธ์ธ ์ดˆ๊ธฐํ™”
      bx cs init
    6. CLI (kubectl)์„ ์‚ฌ์šฉํ•œ Kubernetes ํด๋Ÿฌ์Šคํ„ฐ ์ œ์–ด๋ฅผ ์œ„ํ•ด ์ตœ์‹  Kubernetes ์ปค๋งจ๋“œ๋ผ์ธ ์„ค์น˜
  2. ํด๋Ÿฌ์Šคํ„ฐ ์ƒ์„ฑํ•˜๊ธฐ

    Kubernetes pod๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์ปจํ…Œ์ด๋„ˆ ๋ฌถ์Œ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ด pod๋“ค์€ cluster ์ƒ์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค. ๋ณธ ์˜ˆ์ œ์—์„œ๋Š” IBM Cloud ์˜ ๋ฌด๋ฃŒ ํ‹ฐ์–ด ๊ณ„์ •์œผ๋กœ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ƒ์„ฑํ•ด๋ด…๋‹ˆ๋‹ค.

    1. ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•ด ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. (๋ณธ ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” Grace๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.)
      bx cs cluster-create --name [cluster-name]
    2. ์•„๋ž˜ ๊ฒฐ๊ณผ๋กœ ๋‚˜์˜ค๋ฉด ํด๋Ÿฌ์Šคํ„ฐ ์ƒ์„ฑ ์™„๋ฃŒ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
      OK....
    3. bx cs clusters ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•ด ์ •์˜๋œ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ํด๋Ÿฌ์Šคํ„ฐ ์ƒํƒœ๊ฐ€ deployed๊ฐ€ ๋˜์–ด์•ผ pod๋ฅผ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํด๋Ÿฌ์Šคํ„ฐ ๋ฐฐํฌ ์™„๋ฃŒ๊นŒ์ง€๋Š” ์•ฝ 15๋ถ„ ์ •๋„์˜ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค.
    4. ์ƒ์„ฑ๋œ Worker๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด bx cs workers [cluster-name] ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
    5. ํด๋Ÿฌ์Šคํ„ฐ๊ฐ€ ๋ฐฐํฌ๋œ ์ดํ›„ ํด๋Ÿฌ์Šคํ„ฐ ์—ฐ๋™ํ•˜๋Š” Kubernetes ํ™˜๊ฒฝ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
      1. ํ™˜๊ฒฝ ์„ค์ •๊ฐ’ (environment configuration)์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด bx cs cluster-config [cluster-name] ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค
      2. ๋งˆ์ง€๋ง‰ ์ถœ๋ ฅ ๊ฐ’์„ ๋ณต์‚ฌ ๋ถ™์—ฌ๋„ฃ๊ธฐ ํ•˜์—ฌ KUBECONFIG ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  3. * ๋ณธ ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” ๋‹จ์ผ Worker ๋งŒ์œผ๋กœ ์ด๋ฃจ์–ด์ง„ ๋ฌด๋ฃŒ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ํฐ ๊ทœ๋ชจ์˜ multi-worker ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์œ ๋ฃŒ ๊ณ„์ •์œผ๋กœ ์ „ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  4. Watson Conversation ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค ์ƒ์„ฑํ•˜๊ธฐ

    1. Watson Conversation ์„œ๋น„์Šค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
      bx service create conversation free conversation-service-car
    2. ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Œ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
      bx service list
    3. ํด๋Ÿฌ์Šคํ„ฐ ID๊ฐ’์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
      bx cs clusters
    4. ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค์™€ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์—ฐ๊ฒฐํ•ฉ๋‹ˆ๋‹ค.์ด ๋ช…๋ น์–ด ์‹คํ–‰์‹œ Watson ์„œ๋น„์Šค ์ธ์Šคํ„ด์Šค์˜ credential์„ ์ €์žฅํ•˜๋Š” sercret์ด Kubernetes ํด๋Ÿฌ์Šคํ„ฐ ๋‚ด์— ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
      bx cs cluster-service-bind default [๋ฐ”์ธ๋”ฉ ํ•  ์„œ๋น„์Šค ์ด๋ฆ„]
  5. Watson ํŠธ๋ ˆ์ด๋‹ํ•˜๊ธฐ

    Watson Conversation ์„œ๋น„์Šค๋Š” ํŠธ๋ ˆ์ด๋‹ ๋ฐ์ดํ„ฐ๋ฅผ ์›Œํฌ์ŠคํŽ˜์ด์Šค์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์ด ๋‹จ๊ณ„์—์„œ๋Š” ์ด๋ฏธ ์ž‘์„ฑ๋œ ํŠธ๋ ˆ์ด๋‹ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์™€ ์‚ฌ์šฉํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. (GitHub ์ฐธ๊ณ  ๋งํฌ)

    1. ์›Œํฌ์ŠคํŽ˜์ด์Šค ์ •์˜๊ฐ’์„ ๋กœ์ปฌ ๊ฒฝ๋กœ๋กœ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค. ์ €๋Š” ~/Documents ๊ฒฝ๋กœ๋กœ ๋‹ค์šด๋ฐ›์•˜์œผ๋‚˜ ์›ํ•˜๋Š” ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ์„ ํƒํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
      curl https://raw.githubusercontent.com/watson-developer-cloud/conversation-simple/master/training/car_workspace.json >/tmp/car_workspace.json
    2. ๋ธŒ๋ผ์šฐ์ €์—์„œ IBM Cloud (Bluemix) ์›น ์ฝ˜์†”๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
    3. ๋ชจ๋“  ์•„์ดํ…œ ํƒญ์—์„œ Services ๋ฆฌ์ŠคํŠธ์— ์žˆ๋Š” ์ƒˆ๋กœ ์ƒ์„ฑ๋œ Conversation ์„œ๋น„์Šค๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
    4. ์„œ๋น„์Šค ์ƒ์„ธ ํŽ˜์ด์ง€์—์„œ Launch tool์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
    5. Import workspace ์•„์ด์ฝ˜์„ ํด๋ฆญํ•˜๊ณ  ์ด์ „ ๋‹จ๊ณ„์—์„œ ๋กœ์ปฌ ํ™˜๊ฒฝ์— ๋‹ค์šด๋ฐ›์€ /tmp/car_workspace.json ํŒŒ์ผ์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
    6. Everything(Intents, Entities, and Dialog)๋ฅผ ์„ ํƒํ•˜๊ณ  Import๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์ด์ œ car dashboard ์›Œํฌ์ŠคํŽ˜์ด์Šค๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
    7. ๋ฉ”๋‰ด์—์„œ ‘Back to workspace’ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์›Œํฌ์ŠคํŽ˜์ด์Šค๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค.
    8. Car_Dashboard_Current ์›Œํฌ์ŠคํŽ˜์ด์Šค์—์„œ View Details๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.
    9. ํด๋ฆฝ๋ณด๋“œ์—์„œ Workspace ID๋ฅผ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.
  6. Workspace ID๋กœ Kubernetes Configuration Map์„ ์ƒ์„ฑํ•˜๊ธฐ

    1. Kubernetes configuration map์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
      kubectl create configmap car-dashboard-config --from-literal=workspace_id=[์Šคํ… 4.9์—์„œ ๋ณต์‚ฌํ•œ WorkSpace ID]
    2. configuration map ์„ค์ •๊ฐ’์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
      kubectl get configmaps car-dashboard-config -o yaml
  7. Pod๋ฅผ ๋ฐฐํฌํ•˜๊ณ  Watson Conversation ์ƒ˜ํ”Œ ํ™•์ธํ•˜๊ธฐ

      ์ด๋ฒˆ ์Šคํ…์—์„œ ๋ฐฐํฌํ•  pod๋Š” watson-developer-cloud/conversation-simple ์ƒ˜ํ”Œ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. IBMCloudDevOps/watson-conversation-simple-kube repository ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ์—๋Š” Dockerfile๊ณผ ์ด๋ฏธ์ง€ ๋นŒ๋“œ๋ฅผ ์œ„ํ•œ ํŒŒ์ผ, Kubernetes ์„ค์ • ํŒŒ์ผ ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

    1. IBMCloudDevOps/watson-conversation-simple-kube repository ๋ฅผ ํด๋ก ํ•ฉ๋‹ˆ๋‹ค.
    2. ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋ณ€๊ฒฝํ•˜์—ฌ yml ํŒŒ์ผ์— ์ •์˜๋œ pod๋ฅผ ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.car-dashboard-pod.yml ํŒŒ์ผ ์—๋Š” ๋ฐฐํฌํ•  ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ Pod์™€ ํ•ด๋‹น Pod๋ฅผ ๋…ธ์ถœํ•˜๋Š” ์„œ๋น„์Šค ๋‘๊ฐ€์ง€๊ฐ€ ์ •์˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. yml ํŒŒ์ผ์— ๋ช…์‹œ๋œ ์ •์˜์— ๋”ฐ๋ผ pod์™€ ์„œ๋น„์Šค๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
      cd watson-conversation-simple-kube
      kubectl create -f car-dashboard-pod.yml
    3. Worker node์˜ Public IP ์ฃผ์†Œ๋ฅผ ํ™•์ธํ•˜์—ฌ Pod๋กœ ์ ‘์†ํ•  IP ์ฃผ์†Œ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
      bx cs workers [cluster-name]
    4. ๋ฐฐํฌ๋œ pod๊ฐ€ listening ํ•˜๋Š” ์™ธ๋ถ€ ํฌํŠธ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. [์ฐธ๊ณ ]: bot-son ์ปจํ…Œ์ด๋„ˆ๋Š” 3000ํฌํŠธ๋ฅผ ๋ฆฌ์Šค๋‹ํ•˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.Kubernetes ๋Š” ์ด ํฌํŠธ์™€ ํผ๋ธ”๋ฆญํ•˜๊ฒŒ ๋…ธ์ถœ๋  ํฌํŠธ๋ฅผ ๋งตํ•‘ ํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ์ ์œผ๋กœ ํผ๋ธ”๋ฆญ ํฌํŠธ๋กœ 31304๋ฅผ ํ• ๋‹น๋ฐ›์•˜์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Pod์— ์ ‘์†์‹œ ์ด ํผ๋ธ”๋ฆญ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
      kubectl get services bot-son
    5. Watson Conversation ์ƒ˜ํ”Œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋‹ค์Œ ์ฃผ์†Œ๋กœ ์•ก์„ธ์Šค ํ•ฉ๋‹ˆ๋‹ค. ๊ฒฐ๊ณผ๊ฐ’์— ๋”ฐ๋ผ ์ €๋Š” http://173.193.106.110:31304/ ๋กœ ์ ‘์†ํ–ˆ์Šต๋‹ˆ๋‹ค.
      http://[Worker Node์— ๋Œ€ํ•œ Public IP]:[Public Port]/
  8. ํด๋Ÿฌ์Šคํ„ฐ์™€ ์„œ๋น„์Šค ์—ฐ๊ณ„ ๊ณผ์ • ๋“ค์—ฌ๋‹ค๋ณด๊ธฐ

    ์•ž์„œ IBM Cloud์—์„œ Watson ์„œ๋น„์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ  Kubernetes ํด๋Ÿฌ์Šคํ„ฐ์™€ ์—ฐ๋™ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ถ€๋ถ„์„ ์กฐ๊ธˆ ๋” ์ƒ์„ธํžˆ ๋“ค์—ฌ๋‹ค๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.
    * ์ƒ์„ฑํ•œ Watson Conversation ์„œ๋น„์Šค (conversation-service-car)์™€ Kubernetes ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์—ฐ๊ฒฐ์‹œ binding-conversation-service-car๋ผ๋Š” Kubernetes secret์„ ์ƒ์„ฑํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
    * ์ด Secret ์€ JSON ํ˜•ํƒœ์˜ ๋ฐ์ดํ„ฐ์™€ ํ•จ๊ป˜ binding ์ด๋ผ๋Š” ํ‚ค๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
    {"url":"https://gateway.watsonplatform.net/conversation/api","username":"service-instance-user-uuid","password":"service-instance-password"}
    * ์ด Secret์€ Kubernetes ์˜ Pod ์„ค์ •์„ ํ†ตํ•ด CONVERSATION_SERVICE_CAR๋ผ๋Š” ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋กœ ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์— ๋งตํ•‘์ด ๋ฉ๋‹ˆ๋‹ค.
    * ๋ณธ ํŠœํ† ๋ฆฌ์–ผ์—์„œ Pod๋กœ ์‹คํ–‰ํ•œ ์ƒ˜ํ”Œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ (watson-conversation-simple)์€ Watson ์„œ๋น„์Šค์™€ ์—ฐ๋™ํ•˜๊ธฐ ์œ„ํ•ด ํ™˜๊ฒฝ ๋ณ€์ˆ˜์ธ CONVERSATION_USERNAME ๊ณผ CONVERSATION_PASSWORD๋ฅผ ํ•„์š”๋กœ ํ•ฉ๋‹ˆ๋‹ค.
    * ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰์‹œ ๋‚ด๋ถ€์— ์žˆ๋Š” run-server.sh ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž๋™์œผ๋กœ ์‹คํ–‰ํ•ด ์ปจํ…Œ์ด๋„ˆ ํ™˜๊ฒฝ์„ ์…‹ํŒ…ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋ณธ ์˜ˆ์ œ์—์„œ๋Š” CONVERSATION_SERVICE_CAR ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋กœ๋ถ€ํ„ฐ ํ•„์š”ํ•œ ๊ฐ’์„ ํŒŒ์‹ฑํ•ด์„œ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

    export CONVERSATION_USERNAME=$(echo "$CONVERSATION_SERVICE_CAR" | jq -r '.username')

    * ์ด๋ ‡๊ฒŒ ์ •์˜๋œ Kubernetes์˜ secret์„ Kubernetes ๋Œ€์‹œ๋ณด๋“œ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ปค๋งจ๋“œ๋ผ์ธ์—์„œ kubectl proxy ์‹คํ–‰์‹œ http://127.0.0.1:8001/ui์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์— ๋Œ€ํ•œ ๋Œ“๊ธ€์ด 1๊ฑด ์žˆ์Šต๋‹ˆ๋‹ค"Kubernetes Pod์™€ Watson Conversation ์„œ๋น„์Šค ์—ฐ๋™ํ•˜๊ธฐ"

  1. ์กฐ์˜ํ˜ธ 12์›” 14, 2017

    ๋„ˆ๋ฌด ์ž˜ ์ •๋ฆฌ๋˜์–ด์žˆ๋„ค์š”! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹คใ…Žใ…Žใ…Ž

ํ† ๋ก  ์ฐธ๊ฐ€

์ด๋ฉ”์ผ์€ ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ์ž…๋ ฅ์ฐฝ์€ * ๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.