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
460
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
94
Fragmentación, el virus que puede acabar con tu alta disponibilidad (con ejemplos para kubernetes)
agonzalezro
0
420
From source code to Kubernetes, a Continuous Deployment tale
agonzalezro
0
110
From pets to cattle, the way of Kubernetes
agonzalezro
2
620
Kubernetes 101
agonzalezro
0
640
Custom Volume Plugins
agonzalezro
1
1.3k
Docker 101
agonzalezro
4
200
Go 101 updated
agonzalezro
0
810
Kubernetes Volume Plugins: Flocker
agonzalezro
2
760
Other Decks in Technology
See All in Technology
re:Invent2025 セッションレポ ~Spec-driven development with Kiro~
nrinetcom
PRO
2
160
モダンデータスタックの理想と現実の間で~1.3億人Vポイントデータ基盤の現在地とこれから~
taromatsui_cccmkhd
2
290
ECS_EKS以外の選択肢_ROSA入門_.pdf
masakiokuda
1
120
AI with TiDD
shiraji
1
330
Directions Asia 2025 _ Let’s build my own secretary (AI Agent) Part 1 & 2
ryoheig0405
0
110
Autonomous Database - Dedicated 技術詳細 / adb-d_technical_detail_jp
oracle4engineer
PRO
5
11k
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
0
540
The State of AI Agent Security:2025年の総括と2026年の宿題
pict3
0
110
AWSの新機能をフル活用した「re:Inventエージェント」開発秘話
minorun365
2
520
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
160
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
800
AWS re:Inventre:cap ~AmazonNova 2 Omniのワークショップを体験してきた~
nrinetcom
PRO
0
120
Featured
See All Featured
How to make the Groovebox
asonas
2
1.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
350
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
56
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
240
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
0
980
How to Ace a Technical Interview
jacobian
281
24k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
270
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
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