๋กœ์ผ“๐Ÿพ
article thumbnail
[Istio] Istio Ingress ์— ALB ๋ฅผ ๋ถ™์—ฌ๋ณด์ž !
DevOps/Istio 2023. 2. 12. 19:10

Istio ๋Š” ํ”ํžˆ K8S ํด๋Ÿฌ์Šคํ„ฐ ๋‚ด์—์„œ ์„œ๋น„์Šค ๋ฉ”์‹œ ์—ญํ• ์„ ํ•ด์ค๋‹ˆ๋‹ค. ์„œ๋น„์Šค ๋ฉ”์‹œ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ Nginx Ingress, ELB Ingress ์ฒ˜๋Ÿผ Ingress ์—ญํ•  ๋˜ํ•œ ํ•ด์ค๋‹ˆ๋‹ค. Istio Ingress Gateway ๊ฐ€ ์ •์‹ ๋ช…์นญ์ด๋‚˜ ์‰ฝ๊ฒŒ Istio Ingress ๋กœ ์ง€์นญํ•˜๋„๋ก ํ•˜์ฃ  ๐ŸคŸ EKS ์™€ ๊ฐ™์€ ํผ๋ธ”๋ฆญ ํด๋ผ์šฐ๋“œ๋ฅผ ์ด์šฉํ•ด์„œ Load Balancer Service ๋ฅผ ์ƒ์„ฑํ•ด์ฃผ๋ฉด ์ž๋™์œผ๋กœ CLB ๊ฐ€ ํ• ๋‹น๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ Istio Ingress ๋˜ํ•œ CLB ๋กœ ํ• ๋‹น์ด ๋ฉ๋‹ˆ๋‹ค. CLB ๋Š” ์•ž์œผ๋กœ AWS ์—์„œ deprecated ๋˜๊ธฐ ๋•Œ๋ฌธ์— Network Load Balancer(์ดํ•˜ NLB) ๋‚˜ Application Load Balancer(์ดํ•˜ ALB) ๋กœ ๋Œ€์ฒด๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ด๋ฒˆ ๊ธ€์—..

article thumbnail
[Kubernetes] ์นœํ•œ ๋“ฏ, ์•ˆ ์นœํ•œ Pod ์™€ Goofys

Nginx ๊ธฐ๋ฐ˜์˜ Pod ๋‚ด์—์„œ S3 ์™€ Mount ํ•˜๊ธฐ ์œ„ํ•ด goofys ๋ฅผ ์‚ฌ์šฉํ–ˆ๋˜ ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค. (goofys ๋ง๊ณ  EBS ๋‚˜ EFS ๋„ ์œ„์‹œ๋ฆฌ์ŠคํŠธ์— ์žˆ์—ˆ์ง€๋งŒ, goofys ๊ฐ€ ๊ฐ€์žฅ ์ ํ•ฉํ•˜๋‹ค๊ณ  ํŒ๋‹จํ•˜์—ฌ goofys ๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค) ๊ทธ๋ฆผ์œผ๋กœ ํ‘œํ˜„ํ•˜์ž๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ฃ . Nginx ๊ฐ€ provisioning ๋  ๋•Œ ConfigMap ์œผ๋กœ init.sh ๋ฅผ ์ฃผ์–ด goofys ๋ฅผ ๋งˆ์šดํŠธ ํ•œ ํ›„ ์‹คํ–‰๋˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฐ์‹์œผ๋กœ ๋ง์ด์ฃ . #!/usr/bin/env sh set -eu wget https://github.com/kahing/goofys/releases/latest/download/goofys chmod +x goofys /goofys /var/nginx ... nginx -g 'daemo..

article thumbnail
[Kubernetes] ์ธ์ฆ/์ธ๊ฐ€์™€ ETCD ์‚ฌ์ด ๊ทธ ๋…€์„ - Admission Controller
DevOps/Kubernetes 2023. 1. 24. 18:42

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋Š” ๋‹ค๋ฅธ ํ”Œ๋žซํผ์ฒ˜๋Ÿผ ์ธ์ฆ(Authentication)/์ธ๊ฐ€(Athorization) ๋ฅผ ์ œ๊ณตํ•ด์ค๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ธ์ฆ๋ฐ›์ง€ ๋ชปํ•œ ์‚ฌ์šฉ์ž๋ผ๋ฉด 401 (UnAuthorized) ๋ฅผ ์‘๋‹ต ๋ฐ›๊ณ , ์ธ์ฆ์€ ๋˜์—ˆ์ง€๋งŒ ๊ถŒํ•œ์ด ์—†๋‹ค๋ฉด 403(Forbidden) ์‘๋‹ต์„ ๋ฐ›๊ฒŒ ๋˜์ฃ . ์•„์ฃผ ํ‰๋ฒ”ํ•œ ์ธ์ฆ/์ธ๊ฐ€ ํ”„๋กœ์„ธ์Šค์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ธ์ฆ/์ธ๊ฐ€๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ๋‹ค๊ณ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ํ™˜๊ฒฝ์— ๋ฐ”๋กœ ์ ์šฉํ•  ์ˆœ ์žˆ๋Š” ๊ฑด ์•„๋‹™๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๋‚ธ ์š”์ฒญ์„ ์ ์šฉํ•˜๊ธฐ ์ง์ „ ํ•œ ๊ตฐ๋ฐ๋ฅผ ๋” ๋“ค๋ฆฝ๋‹ˆ๋‹ค. ๊ทธ๊ฒƒ์ด ๋ฐ”๋กœ Adimission Controller ์ž…๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” Adimission Controller ์— ๋Œ€ํ•œ ๊ฐœ๋…์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช…ํ•˜๊ณ , Adimission Controller ๋ฅผ ๊ตฌํ˜„ํ•ด๋ณผ ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค. ๐Ÿ˜Ž Admission Controller ๊ฐ€..

article thumbnail
[๊ฒ‰ํ•ฅ๊ธฐ ์‹œ๋ฆฌ์ฆˆ] ๋ช…๋‹จ์— ์žˆ๋„ค์š”, ๋“ค์–ด์˜ค์‹œ์ฃ ! - Iptables ํŽธ

Iptables ๋ฅผ ์•Œ์•„๋ณด๊ธฐ ์ „์— ๋จผ์ € Netfilter ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ฃ  ! Netfilter ์™€ Iptables AWS EC2 ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ๋•Œ Security Group ์ด๋ผ๋Š” ๊ฒƒ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฆ„ ๊ทธ๋Œ€๋กœ ์™ธ๋ถ€๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์„ ์กฐ์ ˆํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ฐฉํ™”๋ฒฝ ๊ธฐ๋Šฅ์ด์ฃ . EC2 ์ธ์Šคํ„ด์Šค ์•ž๋‹จ์— ์ด๋ฅผ ์ฒ˜๋ฆฌํ•ด์ฃผ๋Š” ์•„๋งˆ ๋ฌผ๋ฆฌ์ ์ธ ๊ธฐ๊ณ„๊ฐ€ ์žˆ์–ด์„œ ์–ด๋–ค ํŠธ๋ž˜ํ”ฝ์€ ํ—ˆ์šฉํ•˜๊ณ , ์–ด๋–ค ํŠธ๋ž˜ํ”ฝ์€ ๊ฑฐ๋ถ€ํ•˜๊ฒ ์ฃ . Security Group ์ด ํ•˜๋“œ์›จ์–ด ๋ฐฉํ™”๋ฒฝ ์ด๋ผ๋ฉด Netfilter ๋Š” ์†Œํ”„ํŠธ์›จ์–ด ๋ฐฉํ™”๋ฒฝ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค. Netfilter ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํŠน์ง•์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์†Œํ”„ํŠธ์›จ์–ด ๋ฐฉํ™”๋ฒฝ ํŒจํ‚ท ํ•„ํ„ฐ๋ง ๋ฆฌ๋ˆ…์Šค ์ปค๋„ ๋‚ด๋ถ€์˜ ํ”„๋ ˆ์ž„์›Œํฌ ํฌํŠธ ์ฃผ์†Œ, ๋ณ€ํ™˜, ํฌํŠธ ํฌ์›Œ๋”ฉ ๋ฐ ํŒจํ‚ท ๋ณ€๊ฒฝ ๋ผ์šฐํŒ… ์ „ํ›„์— ๋ฐ์ดํ„ฐ ๋ฐ..

article thumbnail
[Kubernetes] aws_auth ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค..

ํ…Œ๋ผํผ์€ Code ๋กœ ์ธํ”„๋ผ๋ฅผ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” IaC Tool ์ž…๋‹ˆ๋‹ค. ํŠนํžˆ AWS ์ธํ”„๋ผ๋ฅผ ๊ตฌ์ถ•ํ•  ๋•Œ ์ฐธ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ฃ . module ์„ ์ œ๊ณตํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์–ด๋ ต์ง€ ์•Š๊ฒŒ VPC, EKS, ELB ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ฝ”๋“œ๋ฅผ ๊ด€๋ฆฌ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ํ…Œ๋ผํผ์„ ์ด์šฉํ•ด EKS ๋ฅผ ๊ตฌ์ถ•ํ•˜๋Š” ๊ณผ์ •์—์„œ ๊ฒช์€ ๋ฌธ์ œ์ ๊ณผ ์ด๋ฅผ ํ•ด๊ฒฐํ–ˆ๋˜ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ด์•ผ๊ธฐ ํ•ด๋ณผ๊นŒ ํ•ฉ๋‹ˆ๋‹ค. ์šฐ์„  Apply!! terraform-aws-eks ์— ๊ฐ€๋ณด๋ฉด ์•„์ฃผ ์นœ์ ˆํ•˜๊ฒŒ ํ…Œ๋ผํผ์„ ์ด์šฉํ•ด EKS ๋ฅผ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ๋ ค์ค๋‹ˆ๋‹ค. ๋ฌด์ž‘์ • eks ๋ชจ๋“ˆ์„ import ํ•˜๊ณ  example ๊ณผ EKS Best Practices Guides ์ฐธ๊ณ ํ•˜์—ฌ ํ…Œ๋ผํผ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. provider "kubernetes" { h..

article thumbnail
[๊ฒ‰ํ•ฅ๊ธฐ ์‹œ๋ฆฌ์ฆˆ] k8s์˜ ๋ฆฌ์†Œ์Šค๋ฅผ ์œ„ํ•ด ์น˜์–ผ์Šค - Helm ํŽธ

์™œ Helm ์„ ์‚ฌ์šฉํ•˜๋‚˜์š”? Helm ์ด ๋ฌด์—‡์ธ์ง€ ์•Œ์•„๋ณด๊ธฐ ์ „์— ์™œ ํ•„์š”ํ•œ์ง€ ๋จผ์ € ์•Œ์•„๋ณด์ฃ  ! ๐Ÿง Consistency ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์— ๋ฆฌ์†Œ์Šค๋ฅผ ๋ฐฐํฌํ•˜๋ ค๋ฉด ์•„๋ž˜ ์ด๋ฏธ์ง€์ฒ˜๋Ÿผ yaml ๋กœ ์ž‘์„ฑํ•ด์ฃผ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค. yaml ์ด 1,2 ๊ฐœ๋ผ๋ฉด ๊ด€๋ฆฌ๊ฐ€ ์–ด๋ ต์ง€ ์•Š๊ฒ ์ง€๋งŒ 10๊ฐœ ์ •๋„๋งŒ ๋˜๋„ ๊ด€๋ฆฌํ•˜๊ธฐ๊ฐ€ ๋งค์šฐ ํž˜๋“ค๊ณ  ๋ถˆํŽธํ•ด์ง‘๋‹ˆ๋‹ค. ๋˜ํ•œ kubectl edit์„ ํ†ตํ•ด ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์˜ ๋ฆฌ์†Œ์Šค๋ฅผ ์—…๋ฐ์ดํŠธ ํ•ด์ค„ ์ˆ˜ ์žˆ๋Š”๋ฐ, ์—ฌ๋Ÿฌ ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ด€๋ฆฌ๋ฅผ ํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด ์ผ๊ด€์„ฑ(Consistency) ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Revision History ์–ด๋– ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด Deploy, ConfigMap, Service, Ingress yaml ๋กœ ๋ฐฐํฌ๋œ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ณด์ฃ . ์ด๋•Œ ConfigMap ๊ณผ Service ๊ฐ€ ์—…๋ฐ์ดํŠธ ๋˜์–ด์„œ yaml ์ด ๋ณ€..

article thumbnail
[AWS] rsync ๋ง๊ณ  datasync ! - EFS Data ์ด์ „
AWS 2022. 11. 20. 20:57

EFS (Elastic File System) ์€ AWS ์˜ ํŒŒ์ผ ์‹œ์Šคํ…œ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค. EBS, S3 ์ฒ˜๋Ÿผ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ฐ๊ฐ ์“ฐ์ž„์˜ ๋ชฉ์ ์ด ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ์ž์‹ ์˜ ๋ชฉ์ ์— ๋งž๊ฒŒ ์ž˜ ์‚ฌ์šฉํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. EFS S3 EBS ์‚ฌ์šฉ ์ผ€์ด์Šค ํ”„๋ผ์ด๋น— ์ด๋ฏธ์ง€ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ๊ธ‰ ๋ฐ์ดํ„ฐ ๋ฐฑ์—… ์›น ์„œ๋น„์Šค ๋ฐ ์ปจํ…์ธ  EC2 ์˜ ๋ถ€ํŒ… ๋ณผ๋ฅจ ๊ทธ๋ฆฌ๊ณ  AWS DataSync ๋ฅผ ์ด์šฉํ•˜๋ฉด ์ €์žฅ์†Œ์˜ ๋ฐ์ดํ„ฐ๋“ค์„ ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ์˜ฎ๊ธธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ™์€ VPC ๋‚ด ์ €์žฅ์†Œ๋Š” ๋ฌผ๋ก  ๋‹ค๋ฅธ VPC, ๊ต์ฐจ ๊ณ„์ • ๋ชจ๋‘ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. โœ… ๋‹ค๋ฅธ VPC, ๊ต์ฐจ ๊ณ„์ •์€ ์„œ๋กœ์˜ VPC ๊ฐ€ Peering ๋˜๊ฑฐ๋‚˜ TGW ๋กœ sharing ๋œ ์ƒํƒœ์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค ์ž์„ธํ•œ ๋™์ž‘ ๋ฐฉ์‹์€ ํ™•์ธํ•˜๋ ค๋ฉฐ ์—ฌ๊ธฐ๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ์„ธ์š” ๊ทธ๋Ÿผ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•œ๋ฒˆ DataSy..

article thumbnail
[Kubernetes] User Account ๋ž‘ Service Account ๊ฐ€ ๋‹ค๋ฅธ๊ฑฐ์˜€์–ด?
DevOps/Kubernetes 2022. 11. 20. 14:42

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค๋ฅผ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ฒ˜์Œ User Account ์™€ Service Account ๋ฅผ ์ ‘ํ–ˆ์„ ๋•Œ ๋‹จ์ˆœํžˆ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค API ์„œ๋ฒ„์—๊ฒŒ ์ž๊ฒฉ ์ฆ๋ช…ํ•˜๋Š” ๋ฆฌ์†Œ์Šค์ธ๊ฐ€๋ณด๋‹ค ํ•˜๊ณ  ๋„˜์–ด๊ฐ”๋˜ ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ดํ•ด๊ฐ€ ์•ˆ๋˜์„œ ๊ทธ๋ƒฅ ๋„˜์–ด๊ฐ”๋˜.. ๊ทธ๋ž˜์„œ User Account ๋ž‘ Service Account ๋Š” ๋น„์Šทํ•œ๊ฑฐ !! ๊ฐ™์€ ๊ฑฐ !! ๋ผ๋Š” ์ƒ๊ฐ์„ ๊ฐ€์ง€๊ณ  ์žˆ์—ˆ์ฃ .. ํ•˜์ง€๋งŒ ์ด ๋‘˜์€ ๋ถ„๋ช… ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์—๋Š” ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋‚ด์— ์กด์žฌํ•˜๋Š” ์ž์›์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ์œ„ํ•œ 2๊ฐ€์ง€์˜ account ํƒ€์ž…์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. User Account Service Account ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๊ณต์‹ ๋ฌธ์„œ์—๋Š” ์ด์™€ ๊ฐ™์ด ๋‚˜์™€์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ์–ด์นด์šดํŠธ๋Š” ์‚ฌ๋žŒ์„ ์œ„ํ•œ ๊ฒƒ์ด๋‹ค. ์„œ๋น„์Šค ์–ด์นด์šดํŠธ๋Š” ํŒŒ๋“œ์—์„œ ์‹คํ–‰๋˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ์œ„ํ•œ ๊ฒƒ์ด๋‹ค. 100% ๋งž๋Š” ๋ง์ด์ง€๋งŒ..

article thumbnail
[K8S] EKSCTL ๋ฅผ ์ด์šฉํ•œ EKS ๊ตฌ์„ฑ
... 2022. 8. 3. 23:19

๐Ÿ”— eksctl ๊นƒํ—™ ๐Ÿ”— eksctl ๊ณต์‹ ๋ฌธ์„œ ๐Ÿ”— eksctl config file example eksctl ์„ค์น˜ curl --silent --location "(uname -s)_arm64.tar.gz" | tar xz -C /tmp sudo mv /tmp/eksctl /usr/local/bin eksctl version EKS ๊ตฌ์„ฑ eks ๋Š” ์•„๋งˆ์กด์˜ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์„œ๋น„์Šค์ด๋ฉฐ, eksctl ์€ eks ๋ฅผ ์‰ฝ๊ฒŒ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ์ปค๋งจ๋“œ ํˆด eksctl ๊ณต์‹ ๋ฌธ์„œ๋Š” ๊ต‰์žฅํžˆ ์นœ์ ˆํ•œ ํŽธ์ด๋ผ๊ณ  ์ƒ๊ฐ ๐Ÿ’ก eksctl ์€ EKS ๋ฅผ ์œ„ํ•œ ์ปค๋งจํŠธ ํˆด์ด๋ฏ€๋กœ aws configure ๊ฐ€ ๋œ ์ƒํƒœ์—ฌ์•ผ ํ•จ aws ๋กœ๊ทธ์ธ aws configure 1. Using Config Files (๊ฐ€์žฅ ๊ธฐ๋ณธ) apiVersi..

article thumbnail
[AWS] S3 ํผ๋ธ”๋ฆญ ์•ก์„ธ์Šค ์ฐจ๋‹จ์„ ํ™œ์„ฑํ™” ํ•˜๋ฉด์„œ ๊ฐ์ฒด์— ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์ž!!
AWS 2022. 6. 28. 00:21

S3๋Š” ํผ๋ธ”๋ฆญ ์•ก์„ธ์Šค ์ฐจ๋‹จ ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜์—ฌ ๋ฒ„ํ‚ท ๋‚ด ๊ฐ์ฒด์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ์ œํ•œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํผ๋ธ”๋ฆญ ์•ก์„ธ์Šค ์ฐจ๋‹จ์„ ํ™œ์„ฑํ™” ํ•˜๊ฒŒ ๋˜๋ฉด ์ž์›์„ ์•ˆ์ „ํ•˜๊ฒŒ ๋ณดํ˜ธํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์™ธ๋ถ€์—์„œ ์ ‘๊ทผ์ด ๋ถˆ๊ฐ€๋Šฅํ•ด s3 ๊ฐ์ฒด์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ S3๋Š” ํผ๋ธ”๋ฆญ ์•ก์„ธ์Šค ์ฐจ๋‹จ์„ ํ•˜๋ฉด์„œ ์™ธ๋ถ€์—์„œ ์ ‘๊ทผํ•  ์ˆ˜ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ด์ฃผ๋Š”๋ฐ, ๊ทธ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. Pre-Signed-URL ์„ ์ด์šฉํ•˜์—ฌ S3 ๊ฐ์ฒด ์—…๋กœ๋“œ(PUT)/๋‹ค์šด๋กœ๋“œ(GET) ํ•˜๊ธฐ Pre-Signed-URL ์„ ์ด์šฉํ•˜์—ฌ S3 ๊ฐ์ฒด ์—…๋กœ๋“œ(PUT)๋ฅผ ์ง„ํ–‰ํ•˜๊ณ , ๋‹ค์šด๋กœ๋“œ๋Š” ์„œ๋ฒ„๋ฅผ ํ”„๋ก์‹œ๋กœ ๋‘์–ด ์„œ๋ฒ„์—์„œ S3์— ์ ‘๊ทผํ•˜์—ฌ ๋‹ค์šด๋กœ๋“œ(GET)ํ•˜๊ธฐ Pre-Signed-URL ์„ ์ด์šฉํ•˜์—ฌ S3 ๊ฐ์ฒด ์—…๋กœ๋“œ(PUT)๋ฅผ ์ง„ํ–‰ํ•˜๊ณ , ๋‹ค์šด๋กœ๋“œ๋Š” goofys๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ S3..

article thumbnail
[Kotlin] ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ํ‘œํ˜„์— data ํ•œ์ •์ž๋ฅผ ์‚ฌ์šฉํ•˜๋ผ
... 2022. 6. 16. 21:51

์ด ๊ธ€์˜ ๋‚ด์šฉ์€ [์ดํŽ™ํ‹ฐ๋ธŒ ์ฝ”ํ‹€๋ฆฐ]์„ ์ฐธ๊ณ ํ•ฉ๋‹ˆ๋‹ค. ๋•Œ๋กœ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ํ•œ๊บผ๋ฒˆ์— ์ „๋‹ฌํ•ด์•ผ ํ•  ๋•Œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ์ฝ”๋“œ์ฒ˜๋Ÿผ ๋ง์ด์ฃ . data class Player( val id: Int, val name: String, val points: Int ) val player = Player(0, "Gecko", 9999) data ํ•œ์ •์ž๋Š” ์•„๋ž˜์˜ ํ•จ์ˆ˜๋“ค์„ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค. toString equals ์™€ hashCode copy componentN(component1, component2 ๋“ฑ) toString ํด๋ž˜์Šค์˜ ์ด๋ฆ„๊ณผ ๊ธฐ๋ณธ ์ƒ์„ฑ์ž ํ˜•ํƒœ๋กœ ๋ชจ๋“  ํ”„๋กœํผํ‹ฐ์™€ ๊ฐ’์„ ์ถœ๋ ฅ ํ•ด์ค๋‹ˆ๋‹ค. ์ฃผ๋กœ ๋กœ๊ทธ ์ถœ๋ ฅ์ด๋‚˜ ๋””๋ฒ„๊น… ํ• ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. println(player) // Player(id=0, name=Gecko, p..

article thumbnail
[Spring] Security +Google Oauth2 + JWT ๊ตฌํ˜„ํ•˜๊ธฐ (4) - JWT ์žฌ๋ฐœ๊ธ‰ ํ•ด์ฃผ๊ธฐ
... 2022. 6. 5. 12:44

์ด์–ด์„œ ๊ณ„์† ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ตฌํ˜„ ์ž์ฒด๊ฐ€ ๋ชฉ์ ์ด๋ฏ€๋กœ ์ž์„ธํ•œ ์„ค๋ช…์„ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค. JWT ์ƒ์„ฑํ•˜๊ธฐ JWT์— ๊ถŒํ•œ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ ์ƒ์„ฑํ•œ JWT์— ๋Œ€ํ•ด ์ธ์ฆ/์ธ๊ฐ€ ํ•˜๊ธฐ JWT ์žฌ๋ฐœ๊ธ‰ ํ•ด์ฃผ๊ธฐ (์ง„ํ–‰) ๊ตฌํ˜„ AuthController @RestController @RequestMapping("/auth") class AuthController( private val authService: AuthService ) { /** * token ์ƒ์„ฑํ•ด์„œ ๋ณด๋‚ด์ฃผ๊ธฐ */ @GetMapping("/login") fun login(@AuthenticationPrincipal oAuth2User: OAuth2User): ResponseEntity { return ResponseEntity.ok(authService.login(oAu..

article thumbnail
[Spring] Security +Google Oauth2 + JWT ๊ตฌํ˜„ํ•˜๊ธฐ (3) - ์ƒ์„ฑํ•œ JWT์— ๋Œ€ํ•ด ์ธ์ฆ/์ธ๊ฐ€ ํ•˜๊ธฐ
... 2022. 6. 5. 12:08

์ด์–ด์„œ ๊ณ„์† ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ตฌํ˜„ ์ž์ฒด๊ฐ€ ๋ชฉ์ ์ด๋ฏ€๋กœ ์ž์„ธํ•œ ์„ค๋ช…์„ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค. JWT ์ƒ์„ฑํ•˜๊ธฐ JWT์— ๊ถŒํ•œ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ ์ƒ์„ฑํ•œ JWT์— ๋Œ€ํ•ด ์ธ์ฆ/์ธ๊ฐ€ ํ•˜๊ธฐ (์ง„ํ–‰) JWT ์žฌ๋ฐœ๊ธ‰ ํ•ด์ฃผ๊ธฐ ๊ตฌํ˜„ JwtFilter class JwtFilter( private val jwtProvider: JwtProvider ) : OncePerRequestFilter() { override fun doFilterInternal( request: HttpServletRequest, response: HttpServletResponse, filterChain: FilterChain ) { val jwt = jwtProvider.resolveToken(request) if (StringUtils.hasText(jwt) && ..

article thumbnail
[Spring] Security +Google Oauth2 + JWT ๊ตฌํ˜„ํ•˜๊ธฐ (2) - JWT์— ๊ถŒํ•œ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ
... 2022. 6. 4. 18:36

์ด์–ด์„œ ๊ณ„์† ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ตฌํ˜„ ์ž์ฒด๊ฐ€ ๋ชฉ์ ์ด๋ฏ€๋กœ ์ž์„ธํ•œ ์„ค๋ช…์„ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค. JWT ์ƒ์„ฑํ•˜๊ธฐ JWT์— ๊ถŒํ•œ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ (์ง„ํ–‰) ์ƒ์„ฑํ•œ JWT์— ๋Œ€ํ•ด ์ธ์ฆ/์ธ๊ฐ€ ํ•˜๊ธฐ JWT ์žฌ๋ฐœ๊ธ‰ ํ•ด์ฃผ๊ธฐ ๊ตฌํ˜„ @Component class JwtProvider( private val memberRepository: MemberRepository ) { companion object { private const val AUTHORITIES_KEY = "auth" private const val BEARER_TYPE = "bearer" private const val ACCESS_TOKEN_EXPIRE_TIME = (1000 * 60 * 30) private const val REFRESH_TOKEN_EXPIRE_TIME..

article thumbnail
[Spring] Security +Google Oauth2 + JWT ๊ตฌํ˜„ํ•˜๊ธฐ (1) - JWT ์ƒ์„ฑํ•˜๊ธฐ
... 2022. 6. 4. 18:11

์ด๋ฒˆ ๊ธ€์—์„œ๋Š” Spring Security + Google Oauth2 + JWT๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ตฌํ˜„ ์ž์ฒด๊ฐ€ ๋ชฉ์ ์ด๋ฏ€๋กœ ์ž์„ธํ•œ ์„ค๋ช…์„ ์ƒ๋žตํ•ฉ๋‹ˆ๋‹ค. ์ง„ํ–‰ํ•˜๊ธฐ ์•ž์„œ Google Oauth2 Client_ID, Client_Secret๋Š” ๊ฐœ์ธ์ ์œผ๋กœ ๋ฐ›์œผ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค :) ์•„๋ž˜์™€ ๊ฐ™์€ ์ˆœ์„œ๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค. JWT ์ƒ์„ฑํ•˜๊ธฐ (์ง„ํ–‰) JWT์— ๊ถŒํ•œ ์ถ”๊ฐ€ํ•ด์ฃผ๊ธฐ ์ƒ์„ฑํ•œ JWT์— ๋Œ€ํ•ด ์ธ์ฆ/์ธ๊ฐ€ ํ•˜๊ธฐ JWT ์žฌ๋ฐœ๊ธ‰ ํ•ด์ฃผ๊ธฐ ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” JWT ์ƒ์„ฑํ•˜๋Š” ๋ถ€๋ถ„์— ๋Œ€ํ•ด ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๊ตฌํ˜„ build.gradle.kts import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.springframework.boot") version "2.6.8" id("..

profile on loading

Loading...