๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ 42seoul ํ”„๋กœ์ ํŠธ

[42seoul] ft_services : Kubernetes๋ฅผ ํ™œ์šฉํ•œ (์ž‘์€) ์„œ๋น„์Šค ์•„ํ‚คํ…์ณ ๋ฐฐํฌ

by kukim 2021. 10. 28.

๐ŸŽถ ft_services

@42seoul : (2020.12.15 ~ 2021.01.13)

๐Ÿ“– About

  • Kubernetes๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์•„๋ž˜์˜ ์•„ํ‚คํ…์ณ๋ฅผ ๊ตฌํ˜„ํ•˜์‹œ์˜ค.
  • Docker ๋นŒ๋“œ๋Š” Dockerhub๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์ง์ ‘ DOCKERFILE์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. (OS : alpine)
ft_service_draw

๐Ÿ Run

1.Start setup.sh

  • minikube setting
  • docker build
  • kubectl apply
  • Dashboard
setup

2. kubernetes ์‹œ์—ฐ

nginx_ftps word_php_my
  • Deploy : Grafana, influxDB, telegraf
    • 192.168.99.152:3000
    • k delete deploy:influxdb -> pv ์ €์žฅ๊ณต๊ฐ„ check
    • k apply -f influxdb -> ์žฌ์—ฐ๊ฒฐ okay
grafana_influxdb

3. pkill App in Pods -> restart

  • kubectl exec deploy/nginx -- pkill nginx
  • kubectl exec deploy/ftps -- pkill vsftpd
  • kubectl exec deploy/grafana -- pkill grafana
  • kubectl exec deploy/telegraf -- pkill telegraf
  • kubectl exec deploy/influxdb -- pkill influx
  • kubectl exec deploy/wordpress -- pkill php-fpm7
  • kubectl exec deploy/mysql -- pkill /usr/bin/mysqld
pkill

๐Ÿ“– Review

  • kubernetes, ์ปจํ…Œ์ด๋„ˆ ์˜ค์ผ€์ŠคํŠธ๋ ˆ์ด์…˜๋Š” ์•„๋ฆ„๋‹ต๋‹ค. ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด์„œ ์ˆ˜ ๋งŽ์€ ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ํ•˜๋‚˜์˜ ์„œ๋ฒ„์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๊ณ , ๊ฐ๊ฐ์˜ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค Object๋“ค์„ .yaml๋กœ ์ƒํƒœ ๊ด€๋ฆฌํ•˜๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ์„œ๋น„์Šค ํ™•์žฅ์ด ๊ฐ€๋Šฅํ•˜๋ฉฐ ๋ฐฐํฌ, ๋กค๋ฐฑ ๋ฐ ๋ฒ„์ „ ๊ด€๋ฆฌ์— ํƒ์›”ํ•˜๋ฉฐ ๋‹ค์–‘ํ•œ ๋ณผ๋ฅจ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๋‹ˆ ๋Œ€๋‹จํ•˜๋‹ค. ๊ตฌ๊ธ€ ํฌ๊ธฐ์˜ ํšŒ์‚ฌ๊ฐ€ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋กœ ์šด์˜ํ•ด๋„ ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค๊ณ  ํ•˜๋‹ˆ ๊ตฌ๊ธ€๋ณด๋‹ค ํฐ ๊ธฐ์—…์ด์ง€ ์•Š๋Š” ์ด์ƒ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋กœ ๋ชจ๋“  ํ•ด๊ฒฐ๋˜์ง€ ์•Š์„๊นŒ ์ƒ๊ฐ์ด ๋“ค์—ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ž‘์€ ์„œ๋น„์Šค์—๊ฒ ์˜ค๋ฒ„ ์ŠคํŽ™์ด๋ผ๊ณ  ๋Š๊ปด์กŒ๋‹ค.
  • kubernetes์˜ ๊ฐœ๋…, ๊ธฐ๋ณธ์ ์ธ Object(pod, deployment, service …), ์™ธ๋ถ€ ์ ‘์† ์„ค์ •(Cluster IP, LoadBalancer), ์Šค์ผ€์ผ ์•„์›ƒ์„ ๋ง›๋ณด์•˜๋‹ค. (์•„! ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๊ฐ€ ์ด๋Ÿฐ๊ฑฐ๊ตฌ๋‚˜?!)
  • ์•„์‰ฌ์šด ์  : ์‹ค๋ฌด์—์„œ ์ง„ํ–‰ํ•œ ํ”„๋กœ์ ํŠธ๊ฐ€ ์‹ค๋ฌด์—์„  ์–ด๋Š์ •๋„ ์ˆ˜์ค€์ผ๊นŒ ๊ถ๊ธˆํ–ˆ๊ณ , ์‹ค์ œ๋กœ ์–ด๋–ป๊ฒŒ ๊ตฌํ˜„ํ• ๊นŒ ์˜๋ฌธ์ด ๋“ค์—ˆ๋‹ค. ๋˜ํ•œ ์ถ”ํ›„์— CI/CD ์ ์šฉ๊ณผ kubeflow ์„œ๋น„์Šค๋„ ์ถ”๊ฐ€ํ•ด๋ณผ ์ƒ๊ฐ์ด๋‹ค.

๐Ÿ”— Reference

๐Ÿง‘๐Ÿป‍๐Ÿ’ป Author

kukim

ํƒœ๊ทธ

, ,

๋Œ“๊ธ€0