What's new in "serverless" on Google Cloud Platform — MicroXchg Berlin 2019

What's new in "serverless" on Google Cloud Platform — MicroXchg Berlin 2019

Plenty of novelties in the Serverless offering of Google Cloud Platform, whether you’re developing functions, apps or containers.

Let’s get started with the new modern runtimes for the venerable Google App Engine, sandboxed thanks to the open source gVisor container sandboxing technology. Cloud Functions is now GA with Node.js, but also offers new languages like Python to let you implement your functions. If you need more flexibility, you will also be able to run serverless containers: just dockerize your project and off you go!

But the crux of the show has to be the new open source project, Knative, a collaboration of Google with key vendors like Pivotal, IBM, Red Hat or SAP, which offers a set of portable building blocks on top of Kubernetes to build serverless platforms. Additionally, you will be able to try out Knative on Google Kubernetes Engine thanks to a dedicated add-on.

In this session, we’ll review all the new serverless-related features of Google Cloud Platform with concrete demos, so you can get started easily and rapidly.

137d3908243acfc30e126615d59d4e6d?s=128

Guillaume Laforge

April 02, 2019
Tweet

Transcript

  1. @glaforge What’s new in Serverless on Google Cloud Platform Guillaume

    Laforge @glaforge Developer Advocate Google Cloud
  2. @glaforge Google Cloud Platform

  3. @glaforge A big global network of data centers https://cloud.google.com/about/locations/

  4. @glaforge Machine Learning Cloud ML Platform Vision API Video Intelligence

    API Speech API Translate API NLP API Compute Compute Engine App Engine Kubernetes Engine Container Registry Cloud Functions Networking Cloud Virtual Network Cloud Load Balancing Cloud CDN Cloud Interconnect Cloud DNS Storage & Databases Cloud Storage Cloud Bigtable Cloud Datastore Cloud SQL Cloud Spanner Big Data BigQuery Cloud Dataflow Cloud Dataproc Cloud Dataprep Cloud Datalab Cloud Pub/Sub Genomics Management Stackdriver Overview Monitoring Logging Error Reporting Debugger Deployment Manager Developer Cloud SDK Deployment Manager Cloud Source Repositories Cloud Endpoints Cloud Tools for Android Studio Cloud Tools for IntelliJ Google Plugin for Eclipse Cloud Test Lab Cloud Container Builder Identity & Security Cloud IAM Cloud IAP Cloud KMS Cloud Resource Manager Cloud Security Scanner Cloud Platform Security Overview Panorama
  5. @glaforge Not Google’s new serverless data center

  6. @glaforge Serverless model(s) Operational model Fully managed security Pay only

    for usage No servers Event-driven Open Service-based Programming model
  7. @glaforge The Serverless spectrum

  8. @glaforge Serverless operational spectrum Managed by your cloud Container orchestration

    (k8s) Not serverless for programming or ops Container focused Infra managed by you Hosted FaaS/compute Easiest dev experience Code focused Limited runtime options Managed by your team Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless containers Custom languages & runtimes Infra still cloud-managed
  9. @glaforge Serverless “compute” on Cloud Platform App Engine Standard Highly

    scalable, serverless web applications. Deploy and scale Applications that react to Requests Cloud Functions Event-driven serverless compute platform. Deploy and scale Functions that react to Events
  10. @glaforge Demo: Sharing pictures

  11. @glaforge Demo: Sharing pictures pic-a-daily.appspot.com

  12. @glaforge Demo: Sharing pictures Event-driven logic Data storage User facing

    Frontend Web + API Admin app Picture files Picture metadata & most frequent tags Vision API annotations: Labels, color, filtering Via Pub/sub Compute most popular tags pic-a-daily.appspot.com
  13. @glaforge So what did we launch?

  14. @glaforge New idiomatic App Engine runtimes ◦ Node.js 8 (10

    in beta) ◦ Python 3.7 ◦ PHP 7.2 (beta) ◦ Go 1.11 (beta) ◦ Java 8 (11 in alpha)
  15. @glaforge Alpha for Java 11 Sign-up: goo.gl/b8N7L2

  16. @glaforge ◦ General Availability with SLA ◦ Go, Node &

    Python ▪ Java soon! ◦ Security & scaling controls ◦ Environment Variables Cloud Functions
  17. @glaforge New Go 1.11 runtime

  18. @glaforge Go 1.11, vendor & module friendly package hello import

    ( "fmt" "net/http" ) func HelloWorld(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello, World!") } $ gcloud beta functions deploy hello --entry-point HelloWorld --runtime go111 --trigger-http
  19. @glaforge Node 8 with async / await const PubSub =

    require('@google-cloud/pubsub'); exports.helloPubSub = async (data, context) => { let ps = new PubSub(); try { const topicName = context.resource.name; const topic = ps.topic(topicName); const data = await topic.getMetadata(); const metadata = data[0]; console.log(`Metadata: ${JSON.stringify(metadata)}`); } catch(err) { console.error(err); } };
  20. @glaforge Environment variables $ gcloud beta functions deploy fnNAme --set-env-vars

    FOO=bar $ gcloud beta functions deploy fnNAme --env-vars-file .env.yaml --update-env-vars FOO=baz --remove-env-vars FOO --clear-env-vars
  21. @glaforge Function scaling control Limit scaling on a per-function basis

    Prevents DoSing resources with different scalability $ gcloud functions deploy --max-instances=100
  22. @glaforge Security controls Control access to function invocation using IAM

    • Developers • Other functions or GCP services • End-users using Google Sign-In Set IAM policies on individual functions Private by default
  23. @glaforge Security controls $ gcloud functions add-iam-policy-binding fnOne \ --member='allUsers'

    \ --role='roles/cloudfunctions.invoker' $ gcloud functions add-iam-policy-binding fnTwo \ --member='fnOne@projectid.iam.gserviceaccount.com' \ --role='roles/cloudfunctions.invoker'
  24. @glaforge Per function identities By default, all functions share the

    same identity Identity can be set on a per-function basis to provide least privilege access
  25. @glaforge Per function identities $ gcloud iam service-accounts create fnOne

    $ gcloud iam service-accounts add-iam-policy-binding \ fnOne@projectid.gserviceaccount.com \ --member='serviceAccount:fnOne@projectid.gserviceaccount.com' \ --role='roles/cloudfunctions.invoker' $ gcloud functions deploy fnOne \ --service-account fnOne@projectid.gserviceaccount.com
  26. @glaforge Per function identities $ gcloud iam service-accounts create fnTwo

    $ gcloud iam service-accounts add-iam-policy-binding \ fnTwo@projectid.gserviceaccount.com \ --member='serviceAccount:fnTwo@projectid.gserviceaccount.com' \ --role='roles/cloudsql.client' $ gcloud functions deploy fnTwo \ --service-account fnTwo@projectid.gserviceaccount.com
  27. @glaforge Icing on the planet cake

  28. @glaforge Cloud Tasks • Manage distributed task queues • Decouple

    and scale microservices • Manage resource consumption • Handle releases gracefully Sign up: http://bit.ly/tasks-signup New!
  29. @glaforge Cloud Scheduler • Enterprise grade cron job scheduler •

    Schedule batch, big data jobs, cloud infra ops... ◦ Invoke Cloud Functions over HTTPS or Pub/Sub ◦ Invoke App Engine on a relative url handler • Manage all your jobs from one place Sign up: http://bit.ly/sched-signup New!
  30. @glaforge Serverless Containers

  31. @glaforge Everything at Google runs in containers: Gmail, Web Search,

    Maps, ... MapReduce, batch, ... GFS, Colossus, ... Even GCE itself: VMs in containers Google launches 4 billion containers per week.
  32. @glaforge Serverless operational spectrum Managed by your cloud Container orchestration

    (k8s) Not serverless for programming or ops Container focused Infra managed by you Hosted FaaS/compute Easiest dev experience Code focused Limited runtime options Managed by your team Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless containers Custom languages & runtimes Infra still cloud-managed New!
  33. @glaforge New: serverless containers on GCF (EAP) Serverless containers on

    Cloud Functions Provide arbitrary container images and run them "serverlessly" • Takes a pre-built Docker image • Use arbitrary system libraries • Use arbitrary language runtime • Same serverless execution environment ◦ Stateless, event-driven, auto-scaling ◦ No servers ◦ Pay only while code runs
  34. @glaforge Serverless containers Fully managed BYO workloads Pay for use

    & stateless New: serverless containers on GCF (EAP) Sign up: g.co/serverlesscontainers
  35. @glaforge New: serverless containers on GCF (EAP) $ gcloud functions

    deploy --image gcr.io/...
  36. @glaforge Knative GKE serverless add-on

  37. @glaforge Serverless operational spectrum Managed by your cloud Container orchestration

    (k8s) Not serverless for programming or ops Container focused Infra managed by you Hosted FaaS/compute Easiest dev experience Code focused Limited runtime options Managed by your team Serverless containers Custom languages & runtimes Infra still cloud-managed Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra New!
  38. @glaforge Knative — Serverless building blocks on Kubernetes Kubernetes-based building

    blocks for serverless workloads Build Serving Events
  39. @glaforge Knative partners

  40. @glaforge Knative isn't... • An open source FaaS developer-facing product

    • A product, It's primitives • The right solution for everyone ◦ The audience is more the ops building & running their own serverless platform for the developers
  41. @glaforge GKE serverless add-on — Knative on GKE GKE serverless

    add-on Request early access today at g.co/serverlessaddon
  42. @glaforge $ gcloud serverless deploy --image gcr.io/... --cluster my-cluster Google

    Kubernetes Engine + Knative
  43. @glaforge Q & A cloud.google.com/serverless App Engine Java 11 alpha

    goo.gl/b8N7L2 Knative github.com/knative GKE serverless add-on (sign-up) g.co/serverlessaddon Containers on Cloud Functions (sign-up) g.co/serverlesscontainers
  44. @glaforge Thank you! cloud.google.com/serverless App Engine Java 11 alpha goo.gl/b8N7L2

    Knative github.com/knative GKE serverless add-on (sign-up) g.co/serverlessaddon Containers on Cloud Functions (sign-up) g.co/serverlesscontainers