Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NGINX Plus - マイクロサービスの高可用性 / JapanContainerDays...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
NGINX Japan
December 05, 2018
Technology
2.1k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NGINX Plus - マイクロサービスの高可用性 / JapanContainerDays v18.12
NGINX Japan
December 05, 2018
More Decks by NGINX Japan
See All by NGINX Japan
NGINX / Developers Summit 2019
nginx_jp
0
1.6k
NGINXとApacheざっくり比較 - NGINX MeetUp #1 Lightning Talks
nginx_jp
0
130
NGINX Plusのご紹介 - Red Hat Forum Tokyo 2018
nginx_jp
0
130
Other Decks in Technology
See All in Technology
Service Connect 上のサービスに ECS Service の外側から到達できなかった話
ota1022
1
270
少人数チームで実現する、大規模AWSサーバーレス基盤における"揺らがない"信頼性運用
maimyyym
1
110
LanceDB入門
mocobeta
9
600
現場回帰したデータエンジニアが考える AI 時代のキャリア開発 / Career Development in the Age of AI Perspectives from a Hands-on Data Engineer
medley
0
120
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
150
Master Dataグループ紹介資料
sansan33
PRO
1
4.8k
TypeScript入門 2026
recruitengineers
PRO
3
690
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
120
Bill One 開発エンジニア 紹介資料
sansan33
PRO
7
20k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
その“隠したつもり”が命取り ── 自前と平文をやめて「正解」に委ねる
kuroneko13
0
130
システム思考で問題に対処する
yussak
0
340
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
Prompt Engineering for Job Search
mfonobong
0
410
Everyday Curiosity
cassininazir
0
290
The Language of Interfaces
destraynor
162
27k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
400
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The SEO identity crisis: Don't let AI make you average
varn
0
530
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Become a Pro
speakerdeck
PRO
31
6.2k
[SF Ruby Conf 2025] Rails X
palkan
2
1.3k
Thoughts on Productivity
jonyablonski
76
5.3k
Design in an AI World
tapps
1
280
Transcript
NGINX Plusͷ͝հ ϚΠΫϩαʔϏεͷߴՄ༻ੑ Ingress, αʔϏεϝογϡͷੈքʹ͓͚Δ ϩʔυόϥϯγϯά NGINX ςΫχΧϧ ιϦϡʔγϣϯζ ΞʔΩςΫτ
ాล ໜ @stanabe 2018/12/5
NGINXͷ͝հ NGINX Plus ϚΠΫϩαʔϏεͱαʔϏεϝογϡͷऔΓΈ 1 2 3 ຊͷ༰ NGINX Ingress
Controller 4 2
NGINXͷ͝հ 1
NGINXࣾ • ʹઃཱɺʹNGINX 1MVTͷॳظϦϦʔε 044൛ॳظϦϦʔε • ສҎ্ͷΣϒαΠτ • ΤϯλʔϓϥΠζιϑτΣΞۀքͷϦʔμʔͷϕϯνϟʔΩϟϐλϧͷࢧԉ •
αϯϑϥϯγείɺϩϯυϯɺίʔΫɺγϯΨϙʔϧɺγυχʔɺϞεΫϫɺ౦ژͷΦϑΟε • ࣾҎ্ͷސ٬ • ਓҎ্ͷैۀһ 4
NGINX Unit NGINX ͔Βͷ৽͍͠ಈతͳWebͱΞϓϦ έʔγϣϯɾαʔόʔɻΦʔϓϯιʔεɺ ෳͷݴޠͷαϙʔτɺ͓Αͼಈతͳ REST API ओಋͷߏɻ NGINX
Plus ϩʔυόϥϯαʔɺWebαʔόʔɺίϯςϯ πΩϟογϡΛؚΉ།ҰͷΦʔϧΠϯϫϯι ϦϡʔγϣϯɻίετΛݮ͠ͳ͕ΒɺΞʔ ΩςΫνϟΛ؆ૉԽ͠·͢ɻ NGINX Controller NGINX PlusͷͨΊͷूதࢹ͓Αͼཧɻ ୯Ұͷඒ͍͠ΠϯλʔϑΣΠεΛ༻ͯ͠ɺ ԾϩʔυόϥϯαʔΛల։͠·͢ɻ NGINX WAF Φʔϓϯιʔεͷ WebΞϓϦέʔγϣϯϑΝ ΠΞΥʔϧ (WAF)SQL ΠϯδΣΫγϣϯɺ LFIRFI͓ΑͼͦͷଞͷϨΠϠ7߈ܸΛ ޚ͠·͢ɻ Powered by ModSecurity. 5
ݱࡏͷΞϓϦͷΠϯϑϥෳࡶ 6
NGINXʹΑΓ10ഒ؆ૉԽɾ 80%ίετݮ 7
μΠφϛοΫ ΞϓϦέʔγϣϯ ήʔτΣΠ 8
NGINX ΞϓϦέʔγϣϯ ϓϥοτϑΥʔϜ ϨΨγʔͳϞϊϦγοΫ ΞϓϦ͔ΒϞμϯͳϚΠ ΫϩαʔϏε·Ͱ෯͘ ରԠ͠ɺσδλϧମݧΛ ։ൃఏڙ͢ΔͨΊͷςΫ ϊϩδʔεΠʔτ ϩʔυόϥϯαʔ
API αʔϏεϝογϡ 9
NGINX Plus 2
ߴੑೳͳΞϓϦέʔγϣϯͷ৴ • ৄࡉͰ๛ͳϝτϦοΫ • ڧྗͳෛՙࢄ • ϔϧενΣοΫ • αʔϏεϨδετϦͷ౷߹ •
HTTP/HTTPS/H2/gRPC/TCP/UDP ΤϯλʔϓϥΠζαϙʔτ HTTP HTTPS HTTP/2 gRPC TCP UDP consul etcd 12
NGINX PlusͷμογϡϘʔυ 13 શମ αʔόʔͷঢ়گʢκʔϯʹ͚ͯදࣔʣ Ωϟογϡ ڞ༗ϝϞϦʔ NGINX Plusͷ Πϯελϯεຖͷใ
NGINX Plus: Upstreamͷಈతมߋ ϩʔυόϥϯεઌ (Upstream) ΛಈతʹมߋՄೳ μογϡϘʔυͷGUIͰ APIͰ
ϚΠΫϩαʔϏεͱ αʔϏεϝογϡͷऔΓΈ 3
NGINXɺ͞·͟·ͳϚΠΫϩ αʔϏεΞʔΩςΫνϟΛαϙʔτ 3. Fabric Model 2. Router Mesh Model 1.
Proxy Model 17
Ҡߦεςοϓ 18
NGINX Unit 19 • μΠφϛοΫWebɾ ΞϓϦέʔγϣϯαʔόʔ ◦ γϯϓϧɾܰྔ ◦ ଟݴޠʹରԠ:
Python, PHP, Go, Perl, Ruby, JavaScript (Node.js), Java(༧ఆ) ηοτΞοϓɾઃఆͳͲɺಉ༷ͷڥΛར༻Մೳ ◦ RESTful JSON APIͰͷಈతͳઃఆ ◦ Φʔϓϯιʔε ◦ NGINX PlusϢʔβʔ αϙʔτར༻Մ ◦ NGINXΛαΠυΧʔʹ • Πϯετʔϧ ◦ DockerΠϝʔδɺLinuxύοέʔδɺ ιʔε͔ΒϏϧυ • ઃఆ ◦ APIͰ # curl -X PUT -d @/path/to/start.json --unix-socket /path/to/control.unit.sock http://localhost/config/ ◦ Dockerfileͷྫ FROM nginx/unit:1.3-php7.0 RUN mkdir /www COPY index.php /www/index.php COPY conf.json /var/lib/unit/conf.json CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]
ಈతͳϧʔςΟϯά: αʔϏεͷݕग़ • ͜Μͳͱ͖ʹඞཁ: ◦ ৽͍͠αʔϏε͕Ճ͞Εͨ ◦ طଘͷαʔϏεͷΠϯελϯε͕Ճ͞Εͨ • ϓϩΩγ͕ߏ͞ΕΔτϦΨʔ:
◦ Ansible Roles ◦ Consul templates ◦ DNS A, SRV Ϩίʔυ ◦ AWS Autoscaling άϧʔϓ ◦ Kubernetes (kube-dns) Ingress and Service-to- Service 20
DNSαʔϏεσΟεΧόϦ ༏ઌɾΣΠτ ϙʔτ൪߸ɾϗετ໊ NGINXͷDNSΩϟογϡ༗ޮ࣌ؒ αʔόʔϦετΛDNSͰղܾ UpstreamΛࢀর 21 खಈͰDNSϨίʔυઃఆɺKubernetesͰHeadless Service
࣍ͷεςοϓ: αʔϏεϝογϡͷΦʔέετϨʔγϣϯ • ࢄαʔϏεؒͷ௨৴Λߴɺߴ৴ པɺ͓ΑͼηΩϡΞʹ͢Δωοτ ϫʔΫ • සൟͳαʔϏεมߋʹରͯ͠ɺ ωοτϫʔΫ௨৴ͷ৴པੑΛ֬อ •
αʔϏεϝογϡΛҙࣝ͢Δඞཁ ͳ͘ɺσʔλͱίϯτϩʔϧϓ Ϩʔϯͷ੍ޚΛ αʔϏεϝογϡ ίϯτϩʔϧϓϨʔϯ ΦʔέετϨʔγϣϯ ϓϥοτϑΥʔϜͷ αʔϏεϝογϡ σʔλϓϨʔϯ 24
NGINX Controller: ϞχλϦϯά 25 ଟͷNGINX Plus͔Β౷ܭใΛू
NGINX Controller: ઃఆ 26 nginx.conf ͷ֬ೝ nginx.conf ͷมߋ ઃఆͷݕূ NGINXͷίϯτϩʔϧϓϨʔϯͱͯ͠
·ͣAPI Gateway͔Β
NGINX Ingress Controller 4
NGINX Plus - Kubernetes Ingress Controller NGINX PlusΛೖΓޱͱͯ͠ KubernetesΞϓϦέʔγϣϯΛ࡞ :
• ߴͳෛՙࢄͱSSL/TLS ऴ • WebSocket ͱ HTTP/2 ͷαϙʔτ • ϦΫΤετ͕ΞϓϦέʔγϣϯʹసૹ͞ΕΔ લʹURI ॻ͖͑ • ಈతͳ࠶ߏ • Session persistence • JWT authentication • Prometheusͷαϙʔτ • 24x7 αϙʔτ https://github.com/nginxinc/kubernetes-ingress 28
NGINX Ingress Controller 29 ػೳͳͲ kubernetes/ingress-nginx nginxinc/kubernetes-ingress with NGINX Plus
࡞ऀ Kubernetes ίϛϡχςΟ NGINX Inc ͱίϛϡχςΟ NGINX όʔδϣϯ αʔυύʔςΟϞδϡʔϧΛ ؚΉɺΧελϜNGINXϏϧυ NGINX Plus ༻αϙʔτ No ؚΉ ඪ४ Ingress Yes Yes Annotation Yes Yes ConfigMap Yes Yes TCP/UDP ֦ு Yes Yes JWT ݕূ No Yes ֦ுεςʔλε Yes, αʔυύʔςΟϞδϡʔϧ Yes Prometheus Yes Yes ಈతͳઃఆมߋ Yes (Lua֦ுܦ༝) Yes
GithubϨϙδτϦ 30 • https://github.com/nginxinc/kubernetes-ingress • Docker Πϝʔδ ◦ NGINX (OSS)
ͷඪ४Πϝʔδ͋Γ or ΧελϚΠζͯ͠Ϗϧυ ◦ NGINX Plus ূ໌ॻؚΉΠϝʔδΛϏϧυͯ͠ϓϥΠϕʔτϦϙδτϦ ◦ MakefileϏϧυͯ͠Push·Ͱ • Πϯετʔϧ ◦ KubernetesͷϚχϑΣετɺ·ͨHelmͰ (deployments σΟϨΫτϦ) ◦ ΧελϚΠζαϯϓϧ example σΟϨΫτϦʹ͋Γ • υΩϡϝϯτ ◦ ΠϝʔδͷϏϧυํ๏ɾΧελϚΠζํ๏ ◦ Annotation, ConfigMapͷ͍ํ ◦ ΧελϜAnnotationͷ͍ํ
ઃఆͷରԠ upstream react-ui { server uin-demo:80; } upstream places {
server psn-demo:80; } upstream weather { server wsn-demo:80; } server { listen 80 default_server; server_name "weather-demo.nginxps.com"; location /weather/ { proxy_pass http://weather/; } location /places/ { proxy_pass http://places/; } location / { proxy_pass http://react-ui; } } apiVersion: extensions/v1beta1 kind: Ingress metadata: name: weather-ingress namespace: demo spec: tls: - hosts: - weather-demo.nginxps.com secretName: cafe-secret rules: - host: weather-demo.nginxps.com http: paths: - path: /weather backend: serviceName: weather-service servicePort: 8080 - path: /places backend: serviceName: maps-service servicePort: 8080 - path: / backend: serviceName: poc-ui servicePort: 8080 31 NGINXͷconfϑΝΠϧ IngressͷYAMLϑΝΠϧ
Annotations apiVersion: extensions/v1beta1 kind: Ingress metadata: name: shapes-ingress annotations: kubernetes.io/ingress.class:
"nginx" nginx.org/lb-method: "random" spec: rules: - host: shapes.example.com http: paths: - path: /circles backend: serviceName: circles servicePort: 80 - path: /triangles backend: serviceName: triangles servicePort: 80 33
Snippets apiVersion: extensions/v1beta1 kind: Ingress metadata: name: shapes-ingress annotations: kubernetes.io/ingress.class:
"nginx" nginx.org/lb-method: "random" nginx.org/server-snippets: | location / { return 302 /circles; } spec: rules: - host: shapes.example.com http: paths: . . . 35
ΧελϜ Annotations apiVersion: extensions/v1beta1 kind: Ingress metadata: name: shapes-ingress annotations:
kubernetes.io/ingress.class: "nginx" custom.nginx.org/rate-limiting: "on" custom.nginx.org/rate-limiting-rate: "5r/s" custom.nginx.org/rate-limiting-burst: "1" spec: rules: - host: ”shapes.example.com" http: paths: - path: /circles backend: serviceName: circles servicePort: 80 - path: /triangles backend: serviceName: triangles servicePort: 80 37
Configੜํ๏ ํ๏ ίϯςΫετ ཧऀʹͱͬͯ Ϣʔβʔʹͱͬͯ ConfigMap main, http, server, location,
upstream ؆୯ N/A Annotations server, location, upstream ؆୯ ؆୯ Snippets - ConfigMap main, http, server, location ͍͠ N/A Snippets - Annotations server, location ͍͠ ͍͠ Custom Template - nginx-plus.tmpl main, http ͍͠ N/A Custom Template - nginx-plus.ingress.tmpl http, server, location, upstream ͍͠ N/A Custom Annotations http, server, location, upstream ͍͠ ؆୯ 38
ϞχλϦϯά NGINX Plusͷ ϦΞϧλΠϜɾμογϡϘʔυ $ kubectl -n nginx-ingress port-forward <nginx-ingres—pod>
8080:8080 39
·ͱΊ • ࣗࣾͷWebγεςϜ͕ෳࡶʹͳΓ͍͗ͯ͢Δ ◦ → NGINX Plus! • ϩʔυόϥϯαʔͷϋʔυΣΞͷߋ৽࣌ظʹདྷ͍ͯΔ ◦
→ NGINX Plus! • KubernetesͷIngress ControllerαʔϏεؒ௨৴Λݕূத ◦ → NGINX Plus! ϑϦʔτϥΠΞϧ ͪ͜Β͔Β 40
Thank you! 41