Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Kubernetes on Azure

You're reading from   Hands-On Kubernetes on Azure Automate management, scaling, and deployment of containerized applications

Arrow left icon
Product type Paperback
Published in May 2020
Publisher Packt
ISBN-13 9781800209671
Length 368 pages
Edition 2nd Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Nills Franssens Nills Franssens
Author Profile Icon Nills Franssens
Nills Franssens
Gunther Lenz Gunther Lenz
Author Profile Icon Gunther Lenz
Gunther Lenz
Shivakumar Gopalakrishnan Shivakumar Gopalakrishnan
Author Profile Icon Shivakumar Gopalakrishnan
Shivakumar Gopalakrishnan
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface Section 1: The Basics
1. Introduction to Docker and Kubernetes FREE CHAPTER 2. Kubernetes on Azure (AKS) Section 2: Deploying on AKS
3. Application deployment on AKS 4. Building scalable applications 5. Handling common failures in AKS 6. Securing your application with HTTPS and Azure AD 7. Monitoring the AKS cluster and the application Section 3: Leveraging advanced Azure PaaS services
8. Connecting an app to an Azure database 9. Connecting to Azure Event Hubs 10. Securing your AKS cluster 11. Serverless functions Index

Creating an HTTP-triggered Azure function

In this first example, we will create an HTTP-triggered Azure function. This means that you can browse to the page hosting the actual function:

  1. To begin, we will create a new directory and navigate to that directory:
    mkdir http
    cd http
  2. Now, we will initialize a function using the following command. The --docker parameter specifies that we will build our function as a Docker container. This will result in a Dockerfile being created for us. We will select the Python language, option 3 in the following screenshot:
    func init --docker

    This will create the required files for our function to work:

    After running the funcinit --docker command,four options are provided: dotnet, node, python, and powershell. We select option 3.
    Figure 11.7: Creating a Python function
  3. Next, we will create the actual function. Enter the following code and select the fifth option, HTTP trigger, and name the function python-http:
    func new

    This should result in an output like Figure 11.8:

    The output of the func new command returns nine options. We select the option 5: HTTP trigger.
    Figure 11.8: Creating an HTTP-triggered function
  4. The code of the function is stored in the directory...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime