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
Using external services inside Kubernetes
Search
Maxim Filatov
June 17, 2018
Technology
0
83
Using external services inside Kubernetes
Video:
https://youtu.be/W5wgl1WSDGI
Maxim Filatov
June 17, 2018
Tweet
Share
More Decks by Maxim Filatov
See All by Maxim Filatov
Kubernetes on bare metal: SSL
bregor
1
410
Kubernetes and Weave.net on bare metal
bregor
1
460
Other Decks in Technology
See All in Technology
強いチームと開発生産性
onk
PRO
25
8.5k
エンジニア候補者向け資料2024.11.07.pdf
macloud
0
4.6k
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
460
エンジニアが一生困らない ドキュメント作成の基本
naohiro_nakata
2
160
組み込みLinuxの時系列
puhitaku
4
1.1k
データ活用促進のためのデータ分析基盤の進化
takumakouno
2
730
Microsoft MVPになる前、なってから/Fukuoka_Tech_Women_Community_1_baba
nina01
0
180
フルカイテン株式会社 採用資料
fullkaiten
0
40k
SREの組織類型に応じた リーダシップの考察
kenta_hi
PRO
1
640
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
620
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
360
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
5
1.2k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
570
4 Signs Your Business is Dying
shpigford
180
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
The Cult of Friendly URLs
andyhume
78
6k
Embracing the Ebb and Flow
colly
84
4.5k
Adopting Sorbet at Scale
ufuk
73
9.1k
Designing for Performance
lara
604
68k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Documentation Writing (for coders)
carmenintech
65
4.4k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Transcript
Using external services inside Using external services inside Kubernetes Kubernetes
None
Components Components
Networks Networks Host network: 192.168.0.0/24 Service network: 10.0.0.0/16 Pod network:
172.16.0.0/16
Hosts Hosts master01: 192.168.0.1 master02: 192.168.0.2 master03: 192.168.0.3 pgsql-master: 192.168.0.10
pgsql-slave: 192.168.0.11
Services Services kubernetes: 10.0.0.1 dns: 10.0.0.254
“Normal” ow “Normal” ow
External services External services
Con guration way Con guration way export DATABASE_URL='postgresql://
[email protected]
:5432/production_db'
WRONG WRONG
Database failure Database failure export DATABASE_URL='postgresql://
[email protected]
:5432/production_db' You should resetup ALL
related deployments and restart ALL theirs pods for hosted service address recon guration
DNS way DNS way postgres IN A 192.168.0.10 export DATABASE_URL="postgresql://
[email protected]
:5432/production_db"
WRONG! WRONG!
Database failure Database failure update DNS record Remember about DNS
cache Actually it is easier to kill all related pods
External services. The right External services. The right way way
Use force , Luke! endpoints and services
Obvious example Obvious example $ kubectl get endpoints kubernetes NAME
ENDPOINTS AGE kubernetes 192.168.0.1:8443,192.168.0.2:8443,192.168.0.3:8443 1y $ kubectl get service kubernetes NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.0.0.1 none 443/TCP 1y
In YAML: endpoint In YAML: endpoint apiVersion: v1 kind: Endpoints
metadata: name: kubernetes namespace: default subsets: - addresses: - ip: 192.168.0.1 - ip: 192.168.0.2 - ip: 192.168.0.3 ports: - name: https port: 8443 protocol: TCP
In YAML: service In YAML: service apiVersion: v1 kind: Service
metadata: labels: component: apiserver provider: kubernetes name: kubernetes namespace: default spec: clusterIP: 10.0.0.1 ports: - name: https port: 443 protocol: TCP targetPort: 8443 type: ClusterIP
Back to PostgreSQL Back to PostgreSQL
Endpoint Endpoint apiVersion: v1 kind: Endpoints metadata: name: postgres namespace:
hosted subsets: - addresses: - ip: 192.168.0.10 ports: - name: postgres port: 5432 protocol: TCP
Service Service apiVersion: v1 kind: Service metadata: name: postgres namespace:
hosted spec: ports: - name: postgres port: 5432 protocol: TCP targetPort: 5432 type: ClusterIP
Con guration Con guration export DATABASE_URL='postgresql://
[email protected]
:5432/produc
RIGHT! RIGHT! Service address is rock solid Service IP can
be preserved in service manifest Any host network recon guration is just endpoint upgrade Endpoint upgrade is rocket fast - kube-proxy rocks!
Questions? Questions?