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
クラスタ外から ClusterIP の Service に いい感じにアクセスする / How...
Search
Kazuki Suda
November 27, 2019
Technology
3
1.3k
クラスタ外から ClusterIP の Service に いい感じにアクセスする / How to connect to ClusterIP Service from the outside of Kubernetes cluster
【前夜祭】CloudNative Days Kansai 2019 Meetup /
https://cloudnativedays.connpass.com/event/152321/
Kazuki Suda
November 27, 2019
Tweet
Share
More Decks by Kazuki Suda
See All by Kazuki Suda
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
superbrothers
0
180
実践/先取り「入門 Kubernetes Validating/Mutating Admission Policy」 / CloudNative Days Winter 2024
superbrothers
0
53
個人的、Kubernetes の最新注目機能! (2024年5月版)
superbrothers
0
150
Kubernetes + containerd で cgroup v2 に移行したら "failed to create fsnotify watcher" エラーが発生する原因と対策
superbrothers
0
1.5k
Kubernetes にこれから入るかもしれない注目機能!(2022年11月版)
superbrothers
2
1.5k
コミュニティ/ 勉強会紹介
superbrothers
0
260
高可用性、省力運用を目指す 自宅 Kubernetes クラスタ (K8s@home #1)
superbrothers
12
6.4k
KubeCon + CloudNativeCon Europe 2022 Recap
superbrothers
0
90
独断と偏見で選んだ Kubernetes 1.24 の注目機能と今後!
superbrothers
2
8.6k
Other Decks in Technology
See All in Technology
韓非子に学ぶAI活用術
tomfook
2
580
ThetaOS - A Mythical Machine comes Alive
aslander
0
170
やさしいとこから始めるGitHubリポジトリのセキュリティ
tsubakimoto_s
0
260
Phase01_AI座学_基礎
overflowinc
0
3.9k
BFCacheを活用して無限スクロールのUX を改善した話
apple_yagi
0
120
Laravelで学ぶOAuthとOpenID Connectの基礎と実装
kyoshidaxx
4
1.8k
開発チームとQAエンジニアの新しい協業モデル -年末調整開発チームで実践する【QAリード施策】-
qa
0
290
VSCode中心だった自分がターミナル沼に入門した話
sanogemaru
0
570
データマネジメント戦略Night - 4社のリアルを語る会
ktatsuya
1
230
【PHPerKaigi2026】OpenTelemetry SDKを使ってPHPでAPMを自作する
fendo181
1
190
Phase09_自動化_仕組み化
overflowinc
0
1.7k
スピンアウト講座02_ファイル管理
overflowinc
0
1.3k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8.1k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1k
Agile that works and the tools we love
rasmusluckow
331
21k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
220
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
New Earth Scene 8
popppiees
1
1.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
860
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
410
A designer walks into a library…
pauljervisheath
210
24k
Transcript
【前夜祭】CloudNative Days Kansai 2019 Meetup (2019/11/27) Kazuki Suda, @superbrothers クラスタ外から
ClusterIP の Service に いい感じにアクセスする
Kazuki Suda / @superbrothers ▶ Kubernetes Meetup Tokyo, Prometheus Tokyo
Meetup, Cloud Native Deep Dive 共同主催者 ▶ Kubernetes Active Contributor ▶ CNCF Ambassador
Kubernetes Service リソース ▶ 仮想 IP とポート ▶ L4 ロードバランサに相当
▶ いくつかのタイプ + ClusterIP (Internal) + NodePort + LoadBalancer (External) + Service my-svc タイプ: ClusterIP セレクタ: app=nginx ポート: 8080/tcp→80/tcp clusterIP: 10.0.171.239 Pod A Pod B ReplicaSet app: nginx app: nginx
ClusterIP で作成した Service にクラスタ外からアクセスしたい ▶ がしかし、ClusterIP はクラスタ内からしかアクセスできない
アクセスできないならじゃあどうする $ kubectl port-forward svc/nginx $ kubectl run busybox --rm
--it --image=busybox --restart=Never \ --command -- wget -O- nginx
でもやっぱりクラスタ外からいい感じにアクセスしたい Service リソースの proxy サブリソース
Kubernetes Service proxy サブリソース ▶ /api/v1/namespaces/<namespace>/services/<scheme>:<service>:<port>/proxy
$ kubectl proxy & $ curl 127.0.0.1:8001/api/v1/namespaces/default/services/nginx/proxy/
Service proxy サブリソースをもっともいい感じに使いたい ▶ kubectl open-svc プラグイン
None
# Open service/nginx in namespace/default $ kubectl open-svc nginx -n
default
# How to install kubectl open-svc plugin $ kubectl krew
install open-svc * https://github.com/kubernetes-sigs/krew