Serverless Architectures with Kubernetes

Book description

Deploy, orchestrate, and monitor serverless applications using Kubernetes

Key Features

  • Get hands-on experience with frameworks, such as Kubeless, Apache OpenWhisk, and Funktion
  • Master the basics of Kubernetes and prepare yourself for challenging technical assessments
  • Learn how to launch Kubernetes both locally and in a public cloud

Book Description

Kubernetes has established itself as the standard platform for container management, orchestration, and deployment. By learning Kubernetes, you'll be able to design your own serverless architecture by implementing the function-as-a-service (FaaS) model.

After an accelerated, hands-on overview of the serverless architecture and various Kubernetes concepts, you'll cover a wide range of real-world development challenges faced by real-world developers, and explore various techniques to overcome them. You'll learn how to create production-ready Kubernetes clusters and run serverless applications on them. You'll see how Kubernetes platforms and serverless frameworks such as Kubeless, Apache OpenWhisk and OpenFaaS provide the tooling to help you develop serverless applications on Kubernetes. You'll also learn ways to select the appropriate framework for your upcoming project.

By the end of this book, you'll have the skills and confidence to design your own serverless applications using the power and flexibility of Kubernetes.

What you will learn

  • Deploy a Kubernetes cluster locally with Minikube
  • Get familiar with AWS Lambda and Google Cloud Functions
  • Create, build, and deploy a webpage generated by the serverless functions in the cloud
  • Create a Kubernetes cluster running on the virtual kubelet hardware abstraction
  • Create, test, troubleshoot, and delete an OpenFaaS function
  • Create a sample Slackbot with Apache OpenWhisk actions

Who this book is for

This book is for software developers and DevOps engineers who have basic or intermediate knowledge about Kubernetes and want to learn how to create serverless applications that run on Kubernetes. Those who want to design and create serverless applications running on the cloud, or on-premise Kubernetes clusters will also find this book useful.

Table of contents

  1. Preface
    1. About the Book
      1. About the Author
      2. Learning Objectives
      3. Audience
      4. Approach
      5. Hardware Requirements
      6. Software Requirements
      7. Additional Requirements
      8. Conventions
      9. Installation and Setup
      10. Additional Resources
  2. 1. Introduction to Serverless
    1. Introduction to Serverless
      1. Serverless Origin and Manifesto
      2. Serverless Use Cases
    2. Serverless Architecture and Function as a Service (FaaS)
      1. Function as a Service (FaaS)
      2. Exercise 1: Creating an HTTP Function
    3. Kubernetes and Serverless
      1. Exercise 2: Packaging an HTTP Function as a Container
      2. Exercise 3: Parameterized HTTP Functions
      3. Activity 1: Twitter Bot Backend for Bike Points in London
    4. Summary
  3. 2. Introduction to Serverless in the Cloud
    1. Introduction
      1. Serverless and the Cloud Evaluation Criteria
      2. AWS Lambda
      3. Exercise 4: Creating a Function in AWS Lambda and Invoking It via the AWS Gateway API
      4. Azure Functions
      5. Exercise 5: Creating a Parameterized Function in Azure Functions
      6. Google Cloud Functions
      7. Exercise 6: Creating a Scheduled Function in GCF
      8. Activity 2: Daily Stand-Up Meeting Reminder Function for Slack
    2. Summary
  4. 3. Introduction to Serverless Frameworks
    1. Introduction
    2. Fn Framework
      1. Exercise 7: Getting Started with the Fn Framework
      2. Exercise 8: Running Functions in the Fn Framework
    3. The Serverless Framework
      1. Exercise 9: Running Functions with the Serverless Framework
      2. Activity 3: Daily Weather Status Function for Slack
    4. Summary
  5. 4. Kubernetes Deep Dive
    1. Introduction to Kubernetes
    2. Kubernetes Design and Components
      1. Exercise 10: Starting a Local Kubernetes Cluster
    3. Kubernetes Client Tool: kubectl
      1. Exercise 11: Accessing Kubernetes Clusters Using the Client Tool: kubectl
    4. Kubernetes Resources
      1. Pod
      2. Deployment
      3. StatefulSet
      4. Service
      5. Job and CronJob
      6. Exercise 12: Installing a Stateful MySQL Database and Connecting inside Kubernetes
      7. Activity 4: Collect Gold Prices in a MySQL Database in Kubernetes
    5. Summary
  6. 5. Production-Ready Kubernetes Clusters
    1. Introduction
    2. Kubernetes Setup
      1. Managed Platforms
      2. Turnkey Platforms
      3. Custom Platforms
    3. Google Kubernetes Engine
      1. Exercise 13: Creating a Kubernetes Cluster on GCP
    4. Autoscaling Kubernetes Clusters
      1. Exercise 14: Autoscaling a GKE Cluster in Production
    5. Application Migration in Kubernetes Clusters
      1. Exercise 15: Migrating Applications Running in a GKE Cluster
      2. Activity 5: Minimizing the Costs of Serverless Functions in a GKE Cluster
    6. Summary
  7. 6. Upcoming Serverless Features in Kubernetes
    1. Introduction to Serverless with Kubernetes
      1. Introduction to Knative
      2. Getting Started with Knative on GKE
      3. Exercise 16: Deploying a Sample Application on Knative
    2. Knative Serving Component
      1. Canary Deployment
      2. Exercise 17: Canary Deployment with Knative
    3. Knative Monitoring
    4. Knative Autoscaler
      1. Exercise 18: Autoscaling with Knative
      2. Google Cloud Run
      3. Exercise 19: Deploying Containers on Google Cloud Run
    5. Introduction to Virtual Kubelet
      1. Exercise 20: Deploying Virtual Kubelet on AKS
      2. Activity 6: Deploy a Containerized Application in a Serverless Environment
    6. Summary
  8. 7. Kubernetes Serverless with Kubeless
    1. Introduction to Kubeless
      1. Kubeless Architecture
    2. Creating a Kubernetes Cluster
      1. Creating a Kubernetes Cluster with Minikube
    3. Installing Kubeless
      1. Installing the Kubeless Framework
      2. Installing the Kubeless CLI
      3. The Kubeless UI
    4. Kubeless Functions
      1. Creating a Kubeless Function
      2. Deploying the Kubeless Function
      3. Listing the Kubeless Function
      4. Invoking the Kubeless Function
      5. Updating the Kubeless Function
      6. Deleting the Kubeless Function
      7. Exercise 21: Creating Your First Kubeless Function
    5. Kubeless HTTP Triggers
      1. Exercise 22: Creating an HTTP Trigger for a Kubeless Function
    6. Kubeless PubSub Triggers
      1. Exercise 23: Creating a PubSub Trigger for a Kubeless Function
    7. Monitoring a Kubeless Function
    8. Debugging a Kubeless Function
    9. Serverless Plugin for Kubeless
      1. Activity 7: Publishing Messages to Slack with Kubeless
    10. Summary
  9. 8. Introduction to Apache OpenWhisk
    1. Introduction to OpenWhisk
    2. Running OpenWhisk with IBM Cloud Functions
      1. Exercise 24: Setting Up an IBM Cloud Account
      2. Exercise 25: Installing the IBM Cloud CLI
    3. OpenWhisk Actions
      1. Writing Actions for OpenWhisk
      2. Creating Actions on the OpenWhisk Framework
      3. Listing OpenWhisk Actions
      4. Invoking OpenWhisk Actions
      5. Updating OpenWhisk Actions
      6. Deleting OpenWhisk Actions
      7. Exercise 26: Creating Your First OpenWhisk Action
      8. OpenWhisk Sequences
      9. Exercise 27: Creating OpenWhisk Sequences
      10. OpenWhisk Web Actions
    4. OpenWhisk Feeds, Triggers, and Rules
      1. OpenWhisk CronJob Triggers
      2. Exercise 28: Creating CronJob Triggers
      3. OpenWhisk Packages
      4. Exercise 29: Creating OpenWhisk Packages
      5. Activity 8: Receive Daily Weather Updates via Email
    5. Summary
  10. 9. Going Serverless with OpenFaaS
    1. Introduction to OpenFaaS
      1. Getting Started with OpenFaas on Your Local Minikube Cluster
    2. OpenFaaS Functions
      1. Creating OpenFaaS Functions
      2. Building OpenFaaS Functions
      3. Pushing the OpenFaaS Function Image
      4. Deploying the OpenFaaS Functions
      5. Listing the OpenFaaS Functions
      6. Invoking OpenFaaS Functions
      7. Deleting OpenFaaS Functions
      8. Exercise 30: Creating an OpenFaaS Function with Dependencies
      9. Deploying and Invoking Functions with OpenFaaS Portal
      10. OpenFaaS Functions with HTML Output
      11. Exercise 31: Returning HTML Based on Path Parameters
      12. OpenFaaS Function Observability
      13. Exercise 32: Installing an OpenFaaS Grafana Dashboard
      14. OpenFaaS Function Autoscaling
      15. Activity 9: OpenFaaS Form Processor
    3. Summary
  11. Appendix
    1. 1. Introduction to Serverless
      1. Activity 1: Twitter Bot Backend for Bike Points in London
    2. 2. Introduction to Serverless in the Cloud
      1. Activity 2: Daily Stand-Up Meeting Reminder Function for Slack
    3. 3. Introduction to Serverless Frameworks
      1. Activity 3: Daily Weather Status Function for Slack
    4. 4. Kubernetes Deep Dive
      1. Activity 4: Collect Gold Prices in a MySQL Database in Kubernetes
    5. 5. Production-Ready Kubernetes Clusters
      1. Activity 5: Minimizing the Costs of Serverless Functions in a GKE Cluster
    6. 6. Upcoming Serverless Features in Kubernetes
      1. Activity 6: Deploy a Containerized Application in a Serverless Environment
    7. 7. Kubernetes Serverless with Kubeless
      1. Activity 7: Publishing Messages to Slack with Kubeless
    8. 8. Introduction to Apache OpenWhisk
      1. Activity 8: Receive Daily Weather Updates via Email
    9. 9. Going Serverless with OpenFaaS
      1. Activity 9: OpenFaaS Form Processor

Product information

  • Title: Serverless Architectures with Kubernetes
  • Author(s): Onur Yilmaz, Sathsara Sarathchandra
  • Release date: November 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781838983277