Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kubernetes 入門 #3/kubernetes-hands-on-apps-for-k...
Search
Hiroki Matsumoto
March 22, 2019
Technology
480
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kubernetes 入門 #3/kubernetes-hands-on-apps-for-k8ssa-#3
Hiroki Matsumoto
March 22, 2019
More Decks by Hiroki Matsumoto
See All by Hiroki Matsumoto
システム改善・育成のための障害対応訓練
hirokimatsumoto
0
270
CI/CD環境としてGitHub Actionsを選んだ理由
hirokimatsumoto
0
260
初めてのPSI試験 with Vault Associate
hirokimatsumoto
0
280
多数のプロダクトを開発・運用するためのツール環境
hirokimatsumoto
0
210
デプロイメント手法を選択する/Decide the way of deployment
hirokimatsumoto
2
1.1k
Podライフサイクルを体験する/ux-with-pod-lifecycle
hirokimatsumoto
1
600
Effective Container with VSCode Remote Container
hirokimatsumoto
0
190
GKE+Argo workflow
hirokimatsumoto
1
620
Ansibleをやろうと思ったきっかけ/The-reason-why-I-want-to-learn-Ansible
hirokimatsumoto
0
130
Other Decks in Technology
See All in Technology
spanner-autoscalerに学ぶ CRD設計パターン 〜自動化と緊急時対応を両立する Kubernetesコントローラーの作り方〜
tkuchiki
0
220
カンファレンスに参加した後の浮遊感とセルフケア
pauli
0
280
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
9
2.6k
企業の現実世界をグラフで写し取る
sansantech
PRO
0
230
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
210
Argo CDとAtlantisで実現するインフラ管理のセルフサービス化──小規模SREチームで支えるプラットフォーム
cassius7
0
260
DORA_Metrics.pdf
wagnerfusca
1
140
Databricksメトリクスビューはじめてのもくもく会
taka_aki
0
150
いちAWSエンジニアのAI活用を振り返る #devio2026 / devio osaka 2026 kawahara
masahirokawahara
1
310
[2026 Oracle Technical Deep Dive] AI時代のデータベース基盤をどう選ぶ? Exadata Database Serviceの選択肢と使い分け (2026年9月17日開催)
oracle4engineer
PRO
0
120
The kernel report
ennael
PRO
1
180
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
0
500
Featured
See All Featured
How to make the Groovebox
asonas
2
2.5k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
540
Making the Leap to Tech Lead
cromwellryan
135
10k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
860
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
310
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Transcript
Kubernetes Sapporo for Beginners Kubernetes 入門 #3 ~ ハンズオン:コンテナにアクセス方法 ~
Kubernetes Sapporo for Beginners 自己紹介 松本 宏紀 ( まつもと ひろき
) • Kubernetes Sapporo for Beginners主催者。 • システム・アーキテクト • ソフトウェア・エンジニア • オフショアラボ・チームリーダー • デブサミ2019「Spring Bootでマイクロサービス作って苦労したお話」発表。 Twitter:@hirokimatsumo13
Kubernetes Sapporo for Beginners 今日のゴール 触って学ぶ。見て学ぶ。座学よりも体験を! • Serviceの種類と使い道を知る。 • Ingressの使い方。
• 上記を深く理解するための方法を理解する。
Kubernetes Sapporo for Beginners 事前準備 https://kubernetes-sapporo-for-beginners.github.io/hands-on/Step3-Service-Ingress/ #事前準備
Kubernetes Sapporo for Beginners ヘルプ! 助けてほしい時は手を挙げてください。 助けに Hirose さんがいきます。 (
早い者勝ち! )
Kubernetes Sapporo for Beginners Service 特定のPodの種類( Label Selector) に対してのアクセスを定義します。 TCP/UDP/(
SCTP ) プロトコルをサポート。L4ロードバランシング。 下記のような種類があります。 • ClusterIP • NodePort • LoadBalancer • ExternalName
Kubernetes Sapporo for Beginners 同一クラスタ内 Service: ClusterIP Node-A • クラスタ内で使うもの。
例:内部用バックエンドAPI。 • ロードバランシング方法は、バージョンやその実装に依存。 (GKEだと変更できない) proxy-modeの話はこちら! • クラスタIPを変えたい場合は、再作成が必要。 Node-B Node-C pod-0 pod-1 <<Service>> kube-proxy pod-2 $ kubectl apply -f ./hands-on/Step3-Service-Ingress/service/service-clusterip.yaml $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE greet-cip ClusterIP 10.102.66.190 <none> 80/TCP 19s $ kubectl exec -it cluster-pod -- curl http://greet-cip.default.svc.cluster.local/hello $ kubectl exec -it cluster-pod -- curl http://10.102.66.190/hello $ curl http://10.102.66.190/hello ← OK ← OK ← NG
Kubernetes Sapporo for Beginners 同一クラスタ内 Service: NodePort Node-A • クラスタ外から、各NodeのIPでアクセス可能。
例:GKEだと( 昔は ) ingressと併用。ChatBotとかで適当にア クセスしたい場合も利用してる。 • Port番号が衝突しないように注意が必要。 • Port番号は、30000〜32767の範囲で指定する。 • トラフィック制御はこちら! Node-B Node-C pod-0 pod-1 <<Service>> kube-proxy pod-2 $ kubectl apply -f ./hands-on/Step3-Service-Ingress/service/service-nodeport.yaml $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE greet-nodeport NodePort 10.107.87.220 <none> 80:30000/TCP 1s $ kubectl exec -it cluster-pod -- curl http://greet-nodeport.default.svc.cluster.local/hello $ curl http://10.107.87.220/hello $ curl http://localhost:30000/hello ← OK ← NG ← OK
Kubernetes Sapporo for Beginners 同一クラスタ内 Service: LoadBalancer Node-A • InternalなLBと外部公開用LBの指定が可能。
くわしくは、こちら! • Internal Loadbalancerとして使う事はある。 クラスタ間や、GCEインスタンスとの通信で利用する。 • 実装依存。GKEだとGCLBが出来る。 ※不要になったら削除しようね! • GCLBなどになるので、ファイアウォールの指定も可能。 Node-B Node-C pod-0 pod-1 <<Service>> LoadBalancer pod-2 $ kubectl apply -f ./hands-on/Step3-Service-Ingress/service/service-loadbalancer.yaml $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE greet-lb LoadBalancer 10.110.190.30 localhost 80:30001/TCP 1m $ kubectl exec -it cluster-pod -- curl http://greet-lb.default.svc.cluster.local/hello $ curl http://localhost:30001/hello $ curl http://localhost/hello ← OK ← NG( Only Docker for Desktop ) ← OK
Kubernetes Sapporo for Beginners 同一クラスタ内 Service: ExternalName Node-A • CNAMEとして別名を登録し、外部サービスへの接続先を制御
できる。 ※DNS制御なのでHTTPS通信時はハマるかも。 • 正直API-KEYとかでの連携や、アプリケーション側の設定を 使っていて使う場面に遭遇した事は無い。。。 Node-B Node-C pod-0 pod-1 foo.example.com pod-2 $ kubectl apply -f ./hands-on/Step3-Service-Ingress/service/service-externalname.yaml $ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE search-engine ExternalName <none> iss.ndl.go.jp <none> 24s $ kubectl exec -it cluster-pod -- curl http://search-engine.default.svc.cluster.local/api/opensearch ← OK ← NG( Only Docker for Desktop ) ← OK bar.example.com kube-dns
Kubernetes Sapporo for Beginners その他のService、設定など • Multi-Port Service :複数のポートフォワード設定を定義できるよ。 •
Headless Service :DNSラウンドロビン方式。 kube-proxyを介さない。 • とりあえず困った公式の ここから色々追っていけば、解決するはず。 • Label Selectorによって、振り分けが変わる。
Kubernetes Sapporo for Beginners Ingress L7ロードバランシング。SSLターミネーション。主に外部(インターネット)からのアクセス を制御するために利用される。 よくある、「ロードバランサ」と思えばOKです。 Ingressの実態は、Ingress Controller次第です。後、実運用で使う際は、色々
annotationで指定しないと困る事になるので、各クラウドベンダーさんのドキュメントを 読みましょう。 ※例:静的IPの指定、SSL証明書の指定、ポート80番の不許可など。
Kubernetes Sapporo for Beginners 同一クラスタ内 Ingress Node-A • Ingressは、そのIngress Controller次第で、何が作られるか決
まる。※GKE→GCLB。 • 結構クラウドベンダー依存。 • Docker for DesktopだとIngress Controllerを事前に作成して おく必要がある。 https://github.com/docker/for-win/issues/1901 Node-B Node-C pod-0 pod-1 Ingress pod-2 $ kubectl delete -f ./hands-on/Step3-Service-Ingress/service/ $ kubectl apply -f ./hands-on/Step3-Service-Ingress/ingress/docker-ingress.yaml $ kubectl get ingress NAME HOSTS ADDRESS PORTS AGE ingress.extensions/greet-ingress * localhost 80 7m $ curl http://localhost/v1/hello $ curl http://localhost/v2/hello ← 一旦削除 ← Docker for Desktop用 ※gkeはgcp-ingress.yaml ← OK ← NG( Only Docker for Desktop ) ← OK
Kubernetes Sapporo for Beginners その他の設定など • ingress-nginx annotation • GCP
ingress annotation • その他は・・・調べていないです。 • Ingressで実装されている範囲は、結構バラバラ。長い間 betaです。
Kubernetes Sapporo for Beginners お掃除 使い終わっあたら消すんだよ!クラウド環境を使っている人は特に注意だよ! $ kubectl delete -f
./hands-on/Step3-Service-Ingress/ingress $ kubectl delete -f ./hands-on/Step3-Service-Ingress/prepare
Kubernetes Sapporo for Beginners 振り返り • Declarative object configuration •
再現不可能なスノーフレークサーバーからの脱却! • インフラエンジニア/ソフトウェアエンジニア。Dev/Opsみんながインフラまでの変更内 容を理解できる。再現できる。