Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes...
Transcript of Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes...
![Page 1: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/1.jpg)
Bringing serverless to containers with Google Cloud Run
Dec 3, 2019
Zoë Omander @zoe_omander
Martin Omander @martinomander
![Page 2: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/2.jpg)
Lily started the first Pet Theory clinic 12 years ago
Lily, veterinarian, Founder of Pet Theory
![Page 3: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/3.jpg)
IT growing pains...
Why can’t I change my appointment online?
Michael, client
I have to call insurance companies all the time.
Deirdre, veterinarian
I wasn’t able to send any invoices yesterday. The phone just kept ringing.
Lisa, receptionist
The appointment system is down...
Patrick, IT support
![Page 4: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/4.jpg)
Ruby, Consultant
Lily, veterinarian, Founder of Pet Theory
Solid IT is a requirement for my business.
As a pilot project, let’s fix the invoice problem first.
![Page 5: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/5.jpg)
There are two paths to modern cloud systems.
Z
![Page 6: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/6.jpg)
Containers:Docker, Kubernetes
Serverless:FaaS, PaaS
😀Fine-grained control.
Use any language, binary or library.Run your code in many places.
😨Setup and maintenance work.
Provision resources ahead of time.Pay for idle resources.
😀No infrastructure management.
Fully managed security.Pay only for usage.
😨App is not portable.
Can’t use any language.Can’t use any binary or library.
![Page 7: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/7.jpg)
What if we choose the wrong path?
Patrick, IT support
I have read about a new trend in cloud computing...
Ruby, Consultant
![Page 8: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/8.jpg)
Serverless
Containers
![Page 9: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/9.jpg)
Containers:Docker, Kubernetes
Serverless:FaaS, PaaS
😨Setup and maintenance work.
Provision resources ahead of time.Pay for idle resources.
😨App is not portable.
Can’t use any language.Can’t use any binary or library.
😀Fine-grained control.
Use any language, binary or library.Run your code in many places.
😀No infrastructure management.
Fully managed security.Pay only for usage.
![Page 10: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/10.jpg)
Knativeserverless platform
Cloud Run Events/web + containers
Kubernetescontainer manager
KubernetesEngine
Containerized applications
Linuxoperating system
ComputeEngine
Open source projectRun it hosted on Google Cloud Platform Useful for
Existing, stateful applications
The big picture
![Page 11: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/11.jpg)
Ruby, Consultant
Lily, veterinarian, Founder of Pet Theory
Solid IT is a requirement for my business.
As a pilot project, let’s fix the invoice problem first.
![Page 12: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/12.jpg)
Good work! Let’s review the script.
Our on-prem system generates invoices as DOCX files. Lisa used to manually convert them to PDFs, but I found a Python script that does it.
Patrick, IT support Ruby, Consultant
![Page 13: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/13.jpg)
# app.py
...
cmd = "libreoffice --headless --convert-to pdf {}".format(filename).split(' ')
p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
...
Wait a minute - the Python script is using LibreOffice to create PDFs?
Patrick, IT support
You got a problem with that?
Ruby, Consultant
![Page 14: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/14.jpg)
LibreOffice
Flask web framework
app.py
gunicorn web server
Cloud Storage lib
Let’s package it up in a container.
Container
![Page 16: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/16.jpg)
Ruby, Consultant
Lily, veterinarian, Founder of Pet Theory
Excellent! My staff are asking if cloud computing is sustainable.
Let me do some research...
Z
![Page 17: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/17.jpg)
Power Usage Efficiency (PUE)
Sources
First six bars: United States Data Center Energy Usage Report, www.osti.gov/servlets/purl/1372902/
Last bar: Google website, google.com/about/datacenters/efficiency/internal
![Page 18: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/18.jpg)
![Page 19: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/19.jpg)
Ruby, Consultant
Lily, veterinarian, Founder of Pet Theory
Looks like cloud computing fits with Pet Theory’s values.
I am happy that you are happy.
![Page 20: Bringing serverless to containers with Google Cloud Run · 2020. 7. 8. · Docker, Kubernetes Serverless: FaaS, PaaS 😨 Setup and maintenance work. Provision resources ahead of](https://reader035.fdocuments.us/reader035/viewer/2022062415/5fbd4676c257884abc0b38c1/html5/thumbnails/20.jpg)
Knativeserverless platform
Cloud Run Events/web + containers
Kubernetescontainer manager
KubernetesEngine
Containerized applications
Linuxoperating system
ComputeEngine
Open source projectRun it hosted on Google Cloud Platform Useful for
Existing, stateful applications
The big picture