A Guide to Deploying Airflow on Kubernetes
Tags: gettingstarted, airflow, kubernetes
Published: 2022-08-17 13:47:19

---
title: A Guide to Deploying Airflow on Kubernetes
published: true
date: 2022-06-13 19:51:20 UTC
tags: GettingStarted, Airflow, Kubernetes
canonical_url: https://www.plural.sh/blog/a-guide-to-deploying-airflow-on-kubernetes/
---

 ![A Guide to Deploying Airflow on Kubernetes](https://www.plural.sh/blog/content/images/2022/08/Blog-Post---A-Guide-to-Deploying-Airflow-on-Kubernetes--2.png)

[Apache Airflow](https://airflow.apache.org/) is a workflow management system that allows you to orchestrate sequenceable tasks. It is commonly used for ETL workflows, triggering machine learning jobs, and running DevOps operations such as backup and restore.

Considering its widespread usage, many different use cases, and open-source distribution, Airflow is used on many Kubernetes stacks. However, it can be difficult to configure and run Airflow on Kubernetes, so we want to offer a straightforward path to get you started.

This article will go over setting up a fresh Kubernetes cluster and installing Airflow onto that cluster using [Plural](https://www.plural.sh/), a free open-source Kubernetes DevOps platform that allows you to deploy Kubernetes clusters and open-source applications with little to no management experience necessary.

Additionally, this article will explain how to install other applications onto your Kubernetes cluster, enabling you to collocate Airflow and other applications you want to orchestrate with it.

## Prerequisites

Before getting started with this tutorial you will need your cloud provider’s CLI installed and configured. For more information on this step please refer to our [cloud provider guide](https://docs.plural.sh/quickstart/getting-started#2.-install-and-configure-cloud-provider-cli) and follow the provider-specific instructions.

## Apache Airflow and Kubernetes Installation

### Install Plural CLI and Dependencies

Plural’s CLI can be pulled down via curl, brew, or as a prebaked Docker image. Since we’re on a Mac, we’ll use brew. If you’re not on a Mac, you can use [one of these other options](https://docs.plural.sh/quickstart/getting-started#1.-install-plural-cli-and-dependencies) to pull the CLI down.

brew install pluralsh/plural/plural

Brew will install Plural, alongside terraform, helm, and kubectl for you. If you have already installed any of those dependencies yourself previously, you can add --without-helm, --without-terraform, or --without-kubectl.

### Set up a Repository for Configuration  

Once Plural is installed in your CLI, move to a directory that you use for Git repos and run:

plural init 

This command will start the process of creating a Git repository in the current working directory with [GitHub](https://github.com/)or [GitLab](https://about.gitlab.com/). This repo will hold all of the configuration required for spinning up a Kubernetes cluster. Additionally, it will contain all of the helm and terraform needed for spinning up Plural’s console and your Airflow instance.

If you’re already logged in to [app.plural.sh](https://app.plural.sh/), Plural will recognize that and prompt you to log in there with your previously created account.

First, you are going to choose a name for your cluster and your desired cloud provider and deployment region.

**Note:** For this to work, you will need to configure your cloud provider CLI beforehand.

![A Guide to Deploying Airflow on Kubernetes](https://lh5.googleusercontent.com/UF3NZ2AlQIAmiwNjFmdNWpOmFaPnGJh1cmq5DsgopxsKpf8y2-Emp0Rv092heyJdlEVwEa75xXj66J-_SSEYxQwDdMhI1Mpm4QIvtnljItiKvNJ198pwQNqlCoaDhC7KcTqxUuZd030kB7mzTQ)
_Select your Cloud provider, name your cluster and choose which region to deploy the cluster on. Picture courtesy of Plural._

Plural will now guide you through a few configuration steps to make sure that we can accurately configure and spin up your resources. Let’s break it down into a list.

1. **Bucket Prefix** - _This will be attached to the front of any bucket name for buckets created by Plural on your behalf. This is for deduplication._
2. **Domain Provider** - _To host your applications on the web, you’ll need to configure ingress. We can set this up for you for free, which we recommend. If you have requirements to use your own DNS, check out [this guide](https://docs.plural.sh/setup-and-deployment/dns-setup)._
3. **SCM Provider** - _Basically, will you be using GitHub or GitLab to create your repository? Afterwards, you'll receive an OAuth workflow for us to create your repository on your behalf._
4. **Select an Organization** - _If you’re setting this up as part of a company or organization that you are a part of and have to write permissions for, you can set the repository to be created there. Otherwise, simply pick your personal org._
5. **Saving your SSH keys** - _Generally, don’t save these unless you haven’t configured Git SSH yet. If you can use `git clone` to pull a repository down already, just say no here._
6. **Choose a repo name** - _It’s advised to just pick the same name as your cluster name unless you have a predefined naming scheme or already have a repository with your cluster name._

… And you’re done! If everything went well, your terminal should look like this:

![A Guide to Deploying Airflow on Kubernetes](https://lh4.googleusercontent.com/_1EOVFhVIDD3wc2U1Xa5pzOhno7ICBXU2PsnkgT0DAPAAxLW9xLOLYlpeMOUaV0Lqtv9EWZ08DvhU6j8OsikSlqy6uw38-ur204KI9ZUGDDblKZpSTqnR2d0sdQmEkPs2naPcQjPz6vfpERQtA)
_Make sure to 'cd' into your new workspace. Image courtesy of Plural._

Now that your workspace is properly configured, you can start installing Airflow.

Now, change directories into the repository that you created to start installing applications to your workspace.

### Install the Plural Console

The Plural console provides built-in monitoring of your Kubernetes cluster, tailored dashboards for your applications, incident management, and more. Console setup is not required but is highly recommended.

To check out the name of the console version you want to install for your specific cloud provider you can run plural bundle list console

![A Guide to Deploying Airflow on Kubernetes](https://lh5.googleusercontent.com/YahsiBEfOBWkG5uRMEr3NZH7vF3SrBsIU5LsGgT6m0VaPrwF40dHHBqKkR5tcQQG2XIjiHt7yzI3GdjVsN-1Y7vQSEaOQHE4qr1lV5D47W6_-M-Tnt2_AmPFb2reIi5XzOVPZuHPAMlw1WzhbA)
_Plural bundle list to check out name of the console version you want to install. Image courtesy of Plural._

Using the name you received, you can then install the console with the corresponding command.

plural bundle install console $CONSOLE\_NAME.

Here’s how it would look for AWS:

plural bundle install console console-aws.

You will then be prompted to go through the configuration process for your application. Here you will enter a **vpc\_name** , which will be the name of the virtual private cloud created by Plural for all Plural resources to be hosted in. In most cases it is best to name your vpc **'plural'** - this is a cluster-level setting that we will only ask for once. You will not be prompted to do this again unless you destroy your workspace.

Next, you will name your WAL bucket which contains the write-ahead logs for the Postgres database that backs Plural. To use the default name, hit enter on your keyboard.

Similar to before when you set up DNS for the workspace, you are going to set up a subdomain specific to your application. We recommend you use the following naming convention:

console.$YOUR\_ORG\_NAME.onplural.sh 

After setting up your admin name you will be prompted with the option to enable **"Plural OIDC"**. Open ID Connect allows you to manage authentication across all of your Plural applications by simply being logged in to [app.plural.sh](https://app.plural.sh/).

If you enable Plural OIDC you will no longer need to set up usernames and passwords for every single application that you deploy on Plural. We created this functionality for convenience. However, if you have a restriction on using this for your organization you can choose to not enable OIDC and manually authenticate each application you add to Plural.

Once completed, Plural will have all of the necessary information to successfully create the helm and terraform required for spinning up Plural’s console on Kubernetes.

Here’s how all that should look:

![A Guide to Deploying Airflow on Kubernetes](https://lh3.googleusercontent.com/9YsQ39ZoyO7AUEG2ajkqVKhqB-JI_3_1YWt_77f6ZY-xhJ-PoE9uqJPOYt06s6RhluWkfHIAVIVSJgxucOIZQH0rBvbMsJWZuuQVG5QPoA0839xZcpAv6r4m0FBVYHReGQQG_7HDPxdzN5-ppw)
_You can enable Plural OIDC through the command line. Image courtesy of Plural._

### Install Apache Airflow  

To install Airflow on our configured Kubernetes cluster, we will go through a similar flow. Use the requisite install command:

**AWS** : plural bundle install airflow aws-airflow  
**GCP** : plural bundle install airflow gcp-airflow  
**Azure** : plural bundle install airflow azure-airflow  
**KinD** : plural bundle install airflow kind-airflow

You’ll be guided through another configuration wizard to get your Airflow configuration files set up. To help with every configuration parameter, Plural created a [document](https://docs.plural.sh/applications/repositories/airflow) to answer any questions you might have.

Here’s how it will all look when you’re done:

![A Guide to Deploying Airflow on Kubernetes](https://lh5.googleusercontent.com/jTKwTjPuS8iaglQ9HVgcQL9QqkbVAzBOS6hR2MBAgLWbb_TapZfe9-eIv9_lJK4ywcIvsBsRbAHTocyQmv5c82Kdi_UsVwW2yb6606JIXXVhpR3JH8-hEI_e254SJ67w89pDxaegsMM5CaKmYw)

![A Guide to Deploying Airflow on Kubernetes](https://lh3.googleusercontent.com/jTm8IB7VbxpWs2Hcguqegd8FF3sjoKYBO-8qIjchZTjgtHOU8CdNdkAwmB-02Q0KbC-MoJp9RkWpVu6w9EEsZaq-qhj99TFe6laf8MngLR1ShZ1mHofy1nXxo6nEj6U22Ti7KecF6w65aS6ynA)

**Note** : You can preload your dagRepo with DAGs or add them later, Airflow will run a sync to pick any new DAGs up every few minutes or so.

### Build and Deploy your Infrastructure Configuration  

Now that you have installed all the bundles you need you can run:

plural build

This command tells Plural to write deployment files based on the configuration that we gave in both of these setup processes earlier.

The final step is to run:

plural deploy --commit "initial deploy

By running this command, Plural commits your configuration that we built earlier on your behalf to your Git repo and tells Plural to deploy the configured infrastructure and applications. Once this is kicked off, Terraform will start building the resources that your application needs.

**Note:** This step will likely take several minutes as Plural is requesting infrastructure from your cloud provider.

### 7. Accessing Plural Console and Airflow  

Once your setup is complete, you can now access your Plural console and Airflow instance through your browser. To access your Airflow installation head over to the following URL you defined earlier in your web browser to access the Airflow UI.   
  
**Note:** If you set up Plural OIDC earlier you don’t need to worry about managing authentication for logging into the console or the Airflow UI.   
  
The URL to access your Airflow installation should look like this:

airflow.$YOUR\_ORG\_NAME.onplural.sh

To monitor and manage your brand new Kubernetes cluster and its applications, head over to:

console.$YOUR\_ORG\_NAME.onplural.sh

![A Guide to Deploying Airflow on Kubernetes](https://lh6.googleusercontent.com/4Ro8hSerYgcq4u2JvpkU2ZF5cyjDP8OSeP4QynxfhNrxVdcuRFf-U4WrAZILmH3VaVAPQfAz2jRH4axSWV-Vs-jKjyo3Pb39-EnQd02kaoEfdx-mWM68j-Jc6F143zOcvEEM2fe302PxAM2rsA)

The Plural console acts as your command center for your Plural applications. It comes with a lot of out-of-box functionalities such as:

- **Runbooks:** Recommended settings and optimal operating procedures for running your application.
- **Components:** Statuses for each individual component in your Airflow deployment and Kubernetes cluster. Inside this, you can look into Pod logs and Pod events and use them to drill down into the root cause of any problems with your Kubernetes cluster
- **Nodes:** Graphs and detailed information about the utilization of resources and deployments on each node.
- **Incidents:** View incidents that are automatically created by Plural on component failure. Access a direct connection with our support team to troubleshoot any issues.
- **Dashboards:** View charts that have been tailored for your application. Every Plural application will ship with a custom console dashboard.

## Next Steps with Plural

Through this article, you have learned how to:

- Create a Plural Git repository to store your infrastructure configuration
- Provision a fully configured Kubernetes cluster with no management experience necessary
- Install an instance of Airflow on your fresh Kubernetes cluster

Are you looking to get your Airflow instance up and running on Kubernetes with minimal effort?  
  
Reach out to [me](https://www.linkedin.com/in/avaidyanatha)and the rest of the team over at [Plural](https://www.plural.sh/) to learn more about how Plural works and how we are helping [engineering teams across the world](https://www.plural.sh/blog/how-modeo-utilizes-plural-for-their-customers/) deploy [open-source applications](https://www.plural.sh/blog/how-faros-built-their-open-source-product-using-plural/) in a cloud production environment.

Make sure to join our [Discord](https://discord.com/invite/bEBAMXV64s) community for deployment help, discussion, and meeting other Plural users.  
  
Ready to effortlessly deploy and operate open source applications in minutes? [Get started with Plural today](https://app.plural.sh/).

[Deploy Apache Airflow on Plural](https://app.plural.sh/login)