Preface

Serverless architecture has recently taken center stage in cloud native application deployment. Enterprises started to see the benefits that serverless applications bring to them, such as agility, rapid deployment, and resource cost optimization. As with any other new technology, there were multiple ways to approach and/or employ serverless technologies, such as Function as a Service (FaaS) and Backend as a Service (BaaS)—that is, running your applications as ephemeral containers—with the ability to scale up and down.

Knative was started with the simple goal of having a Kubernetes-native platform to build, deploy, and manage your serverless workloads. Kubernetes solves a lot of cloud native application problems, but with a fair bit of complexity, especially from the perspective of deployment. To make a simple service deployment with Kubernetes, a developer has to write a minimum of two YAMLs, such as a Deployment service, and then perform the necessary plumbing work to expose the service to the outside world. The complexity makes an application developer spend more time crafting the YAMLs and other core platform tasks rather than focusing on the business need.

Knative tries to solve these Kubernetes problems by providing all essential middleware primitives via a simpler deployment model. On Knative you can deploy any modern application workload, such as monolithic applications, microservices, or even tiny functions. Knative can run in any cloud platform that runs Kubernetes, which gives enterprises more agility and flexibility in running their serverless workloads without relying on cloud vendor–specific features.

Why We Wrote This Book

The fact there are “many” ways to do serverless has resulted in confusion among developers, with following questions being raised immediately:

  1. What implementation should I choose: FaaS or BaaS?

  2. What is the quickest way to get started?

  3. What are the use cases for which I can apply serverless technology?

  4. How do I measure the benefits?

  5. What tools I should use to develop the serverless applications?

We had the same set of questions when we started to explore serverless technology. The problems and challenges that we faced during our research became the crux of this cookbook. This book serves as a practical guide in how to solve those challenges, with detailed examples.

It is called a “cookbook” because the examples are structured as “recipes,” each with a Problem, Solution, and a Discussion with possible detailed explanations. As it is impossible to cover all possible serverless methods listed earlier, we decided to choose BaaS. Knative is a Kubernetes-based platform that helps to run your serverless workload in the BaaS way.

Who Should Read This Book

This book is for for architects and developers who have a solid understanding of Kubernetes core concepts and who wish to enhance their knowledge in building real-world applications with Knative.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Note

This element signifies a general note.

Important

This element indicates a warning or caution.

Using Code Examples

You can download this book’s source code from our GitHub Repo as a ZIP file or clone the repository locally using git, as shown here:

$ git clone -b knative-cookbook
https://github.com/redhat-developer-demos/knative-tutorial

$BOOK_HOME is a variable that refers to the source code directory on your machine where you downloaded the recipe code examples.

If you have a technical question or a problem using the code examples, please send email to .

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but generally do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Knative Cookbook by Burr Sutter and Kamesh Sampath (O’Reilly). Copyright 2020 O’Reilly Media Inc., 978-1-492-06119-9.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Staying Up to Date

Though we try to stay with latest version of Knative for this book, Knative is evolving at a rapid rate. To keep up with the latest developments, we suggest that you keep an eye on the upstream community project page as well as Red Hat’s evolving Knative Tutorial.

O’Reilly Online Learning

Note

For more than 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge and expertise through books, articles, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, please visit http://oreilly.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at https://oreil.ly/knative-cookbook.

Email to comment or ask technical questions about this book.

For more information about our books, courses, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Reviewers

Many thanks to our reviewers! They all provided valuable feedback, suggestions, and in some cases alternate solutions; pointed out issues we had overlooked; and in general greatly improved the book. Any errors or omissions in this text are ours and not theirs. An excellent example of their wisdom is the correct observation, “That sentence doesn’t know whether it’s coming or going!”

First Edition: Roland Huss, Matthias Wessendorf, Nicola Ferraro, and Vincent Demeester. Special note of thanks to Ben Browning, Markus Thömmes, and William Markito from the Red Hat Engineering team.

O’Reilly

Thanks to the entire team at O’Reilly, without whom this book would not exist for many reasons, and if it did the content wouldn’t be or look nearly as good!

First Edition: our editors Jeff Bleiel and Sarah Grey.

From the Authors

Burr Sutter

My thanks go first and foremost to Kamesh Sampath—who performed the lion’s share of the work required to create this book—for his expansive technical knowledge and insight, and his relentless diligence and determination in researching, debugging, using, and documenting new technologies like Knative so they become more accessible to the developer community at large.

I am also grateful to the unimaginably diverse global developer community I engage with every day, many of whom have made profound sacrifices to access knowledge and opportunity. There is no question that these are—and will continue to be—the true digital heroes, influencers, change agents, kingmakers, and re-definers of our future. Their efforts remind me that greatness and future impact will be determined not only by talent, but also by an unflinching determination and hunger to learn and imagine and create and master. The opportunity I have as a developer advocate to contribute to these shapers of the future is one of my greatest privileges.

Kamesh Sampath

Thanks to my mentor, manager, and coauthor Burr Sutter for working on this project. His experience and guidance not only helped getting this book into shape, but also allowed me to learn from many different perspectives.

Thanks to Red Hat and Red Hat Developers for giving me this opportunity to author my very first book.

Thanks to my wife who has been a great support to me and without whom I would not have written this book. I should take this moment to thank my son, who does not understand what I am writing but his curious questions like, “Dad, where are you with your book?” or “How is the book coming up?” kept fueling my energy to go that extra mile :).

Thanks all my Gods and Gurus; without their blessings nothing would have been possible.

Last but not least, I wish to extend my gratitude and thanks to all developers who read this book. Without you, the “Developer Community,” we would have never thought to write this book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset