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
Python, Kubernetes & friends
Search
Alexandre González
May 13, 2016
Technology
0
440
Python, Kubernetes & friends
This is the presentation I made for PyGrunn 2016.
Thanks to Jobandtalent for sponsoring my trip! :)
Alexandre González
May 13, 2016
Tweet
Share
More Decks by Alexandre González
See All by Alexandre González
Building an Enterprise-Ready Lambda Experience
agonzalezro
0
78
Fragmentación, el virus que puede acabar con tu alta disponibilidad (con ejemplos para kubernetes)
agonzalezro
0
390
From source code to Kubernetes, a Continuous Deployment tale
agonzalezro
0
91
From pets to cattle, the way of Kubernetes
agonzalezro
2
560
Kubernetes 101
agonzalezro
0
600
Custom Volume Plugins
agonzalezro
1
1.2k
Docker 101
agonzalezro
4
170
Go 101 updated
agonzalezro
0
710
Kubernetes Volume Plugins: Flocker
agonzalezro
2
740
Other Decks in Technology
See All in Technology
ゼロからわかる!!AWSの構成図を書いてみようワークショップ 問題&解答解説 #デッカイギ #羽田デッカイギおつ
_mossann_t
0
1.6k
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
1.8k
20250122_個人向けCopilotどうなん
ponponmikankan
0
130
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
460
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
120
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
250
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
150
Amazon Route 53, 待ちに待った TLSAレコードのサポート開始
kenichinakamura
0
180
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
2024AWSで個人的にアツかったアップデート
nagisa53
1
110
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
360
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
174
51k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Designing for humans not robots
tammielis
250
25k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Side Projects
sachag
452
42k
Music & Morning Musume
bryan
46
6.3k
The Invisible Side of Design
smashingmag
299
50k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Transcript
PYTHON, Kubernetes & FRIENDS @AGONZALEZRO
WHAT IS Kubernetes?
Framework for building distributed systems. (Kelsey's dixit)
None
OUR FIRST APP! $ kubectl run pygrunn \ --image=python:2.7 \
--command -- python -m SimpleHTTPServer
WHAT DO WE GET HERE?
A POD $ kubectl get pods NAME READY STATUS RESTARTS
AGE pygrunn-1906403705-dckh7 1/1 Running 0 1m
A REPLICA SET $ kubectl get replicasets NAME DESIRED CURRENT
AGE pygrunn-1552838933 1 1 11s
AND A DEPLOYMENT $ kubectl get deployments NAME DESIRED CURRENT
UP-TO-DATE AVAILABLE AGE pygrunn 1 1 1 1 2m
SHOW IT TO THE WORLD $ kubectl expose deployment pygrunn
\ --port=80 --target-port=8000 --type=LoadBalancer
LET'S USE THE WAITING TIME $ kubectl exec -it pygrunn-1906403705-dckh7
bash
HERE IT IS $ kubectl get services NAME CLUSTER-IP EXTERNAL-IP
PORT(S) AGE pygrunn 10.3.255.124 130.211.52.23 80/TCP 57s
HN FRONT PAGE! $ kubectl scale deployment pygrunn --replicas=3
THE END (FOR NOW)
None
WHAT WE DID THERE? ▸ Pods ▸ Replica Set ▸
Service ▸ Deployment
A "REAL" DEPLOYMENT
MAIN.PY from flask import Flask, url_for app = Flask(__name__) @app.route('/')
def index(): return '<img width="100%" src="{}" />'.format( url_for('static', filename='grumpy.gif') ) if __name__ == '__main__': app.run(host='0.0.0.0')
DOCKERFILE FROM python:2.7.11-onbuild EXPOSE 5000 CMD ["uwsgi", "-http 5000", "-w
main"]
$ docker build -t agonzalezro/pygrunn:grumpy . $ docker push agonzalezro/pygrunn
DEPLOYMENT.YAML (1/3) apiVersion: extensions/v1beta1 kind: Deployment metadata: name: pygrunn-deploy labels:
name: pygrunn-deploy ...
DEPLOYMENT.YAML (2/3) ... spec: replicas: 3 selector: matchLabels: name: flask-app
template: metadata: labels: name: flask-app ...
DEPLOYMENT.YAML (3/3) ... spec: containers: - name: app image: agonzalezro/pygrunn:grumpy
ports: - containerPort: 5000 - name: nginx image: agonzalezro/pygrunn-nginx ports: - containerPort: 80 readinessProbe: httpGet: path: / port: 80
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: pygrunn-deploy labels: name: pygrunn-deploy
spec: replicas: 3 selector: matchLabels: name: flask-app template: metadata: labels: name: flask-app spec: containers: - name: app image: agonzalezro/pygrunn:happy ports: - containerPort: 5000 - name: nginx image: agonzalezro/pygrunn-nginx ports: - containerPort: 80 readinessProbe: httpGet: path: / port: 80
SERVICE.YAML apiVersion: v1 kind: Service metadata: name: flask-service spec: type:
LoadBalancer ports: - port: 80 targetPort: 5000 selector: name: flask-app
$ kubectl create -f deployment.yaml -f service.yaml
$ sed -i "s/replicas: 3/replicas: 5/" deployment.yaml $ kubectl apply
-f deployment.yaml
$ sed -i "s/grumpy/happy/" deployment.yaml $ kubectl apply -f deployment.yaml
HOMEWORK ▸ Add a nginx in top ▸ Add a
DB ▸ Use a private registry
THE END (AGAIN)
None
None
None
Thanks! @AGONZALEZRO