Giter Club home page Giter Club logo

airflow-kubernetes's Introduction

Learn Terraform - Provision a GKE Cluster

This repo is a companion repo to the Provision a GKE Cluster tutorial, containing Terraform configuration files to provision an GKE cluster on GCP.

This sample repo also creates a VPC and subnet for the GKE cluster. This is not required but highly recommended to keep your GKE cluster isolated.

Create airflow service using these guides:

https://developer.hashicorp.com/terraform/tutorials/kubernetes/gke https://towardsdatascience.com/deploying-airflow-on-google-kubernetes-engine-with-helm-28c3d9f7a26b

Commands ran

Install mac dependencies

brew install gcloud kubectl helm

Setup GCP and terraform

gcloud init gcloud auth application-default login

cd infra/tf terraform init terraform apply

gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)

Install kubernetes dashboard

cd infra/kube kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml kubectl apply -f https://raw.githubusercontent.com/hashicorp/learn-terraform-provision-gke-cluster/main/kubernetes-dashboard-admin.rbac.yaml kubectl apply -f service_account.yaml

Setup kubernetes image pull permissions

This can be the default service account with viewer role:

kubectl create secret docker-registry artifact-registry
--docker-server=https://LOCATION-docker.pkg.dev
--docker-email=SERVICE-ACCOUNT-EMAIL
--docker-username=_json_key
--docker-password="$(cat KEY-FILE)"

kubectl edit serviceaccount default --namespace default

Add to bottom:

imagePullSecrets:
- name: artifact-registry

Push airflow image

cd source docker build . -t europe-west1-docker.pkg.dev/noel-wilson-kube/airflow/airflow-test:latest docker push europe-west1-docker.pkg.dev/noel-wilson-kube/airflow/airflow-test:latest

Setup airflow

kubectl create namespace airflow helm repo add apache-airflow https://airflow.apache.org helm show values apache-airflow/airflow > values.yaml helm upgrade --install airflow apache-airflow/airflow -n airflow -f values.yaml --debug

Go to proxy to debug

kubectl -n kubernetes-dashboard create token admin-user kubectl proxy

Next steps

  1. Create example dag with kubernetes dag

airflow-kubernetes's People

Contributors

im2nguyen avatar noelwilson-brit avatar brianmmcclain avatar judithpatudith avatar hashicorp-copywrite[bot] avatar duplo83 avatar matthiasa4 avatar bbbmau avatar robin-norwood avatar amiga23 avatar zisom-hc avatar

Watchers

Noel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.