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
96
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
820
Kubernetes Volume Plugins: Flocker
agonzalezro
2
770
Other Decks in Technology
See All in Technology
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
2
480
無ければ作る! バイブコーディングで作ったものを一気に紹介
tatsuya1970
0
110
Amazon Bedrock AgentCore EvaluationsでAIエージェントを評価してみよう!
yuu551
0
210
【インシデント入門】サイバー攻撃を受けた現場って何してるの?
shumei_ito
0
1.4k
Databricks Free Edition講座 データサイエンス編
taka_aki
0
270
Meshy Proプラン課金した
henjin0
0
170
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
120
GSIが複数キー対応したことで、俺達はいったい何が嬉しいのか?
smt7174
3
120
Azure SRE Agent x PagerDutyによる近未来インシデント対応への期待 / The Future of Incident Response: Azure SRE Agent x PagerDuty
aeonpeople
0
270
Tebiki Engineering Team Deck
tebiki
0
23k
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
570
MySQLのJSON機能の活用術
ikomachi226
0
130
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
A better future with KSS
kneath
240
18k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
270
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
620
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
86
Game over? The fight for quality and originality in the time of robots
wayneb77
1
93
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