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 to connect to ClusterIP Service from the outside of Kubernetes cluster
Search
Kazuki Suda
November 27, 2019
Technology
3
1.1k
クラスタ外から 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
個人的、Kubernetes の最新注目機能! (2024年5月版)
superbrothers
0
15
Kubernetes + containerd で cgroup v2 に移行したら "failed to create fsnotify watcher" エラーが発生する原因と対策
superbrothers
0
1k
Kubernetes にこれから入るかもしれない注目機能!(2022年11月版)
superbrothers
2
1.3k
コミュニティ/ 勉強会紹介
superbrothers
0
200
高可用性、省力運用を目指す 自宅 Kubernetes クラスタ (K8s@home #1)
superbrothers
9
4.4k
KubeCon + CloudNativeCon Europe 2022 Recap
superbrothers
0
29
独断と偏見で選んだ Kubernetes 1.24 の注目機能と今後!
superbrothers
2
6.7k
わかる!metadata.managedFields
superbrothers
4
1.7k
Local ephemeral-storage のメトリクスを取得するのに kube-summary-exporter がべんり / kube-summary-exporter is useful to get the metrics of local ephemeral-storage
superbrothers
0
490
Other Decks in Technology
See All in Technology
Autonomous Database Cloud 技術詳細 / adb-s_technical_detail_jp
oracle4engineer
PRO
15
36k
NewSQL Landscape
oracle4engineer
PRO
5
3.1k
Step by Stepで学ぶ、ADT(代数的データ型)、モナドからEffect-TSまで
leveragestech
1
2.3k
Shinagile 2024
kawaguti
PRO
1
110
データ分析力を高めるSQL研修サービス『SQL Everyone』
hikarut
1
350
Max out Local LLM in Challenging Environments
sashimimochi
2
230
Observabilityジャーニーを実現するためのAWSサービス:CloudWatch編
o11yfes2023
0
120
Dungeons and Dragons and Rails
joelq
0
220
Google Cloud Next '24 Recap in ZOZO AIにより変わる開発 運用/Development and operation changed by AI
gachimuchiengineer
0
100
グイグイ系QAエンジニアでやっていくよ!
____rina____
0
500
DevRelによる信頼構築とデータ駆動で変わるエンジニア採用 / DevRel Trust Building to Data Driven Engineering Hiring
bobtani
1
120
実例で紹介するRAG導入時の知見と精度向上の勘所
yamahiro
7
2.7k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
13
2.4k
Clear Off the Table
cherdarchuk
85
310k
Unsuck your backbone
ammeep
664
57k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
The Language of Interfaces
destraynor
151
23k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Embracing the Ebb and Flow
colly
80
4.2k
Building Adaptive Systems
keathley
32
1.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
What's new in Ruby 2.0
geeforr
338
31k
Making the Leap to Tech Lead
cromwellryan
125
8.5k
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