maylatt / pipeline-combustiveis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipeline - Preços de Combustíveis

Arquitetura

Fonte de dados : Série Histórica de Preços de Combustíveis

1 - Pré-requisitos

  • Criação do cluster GKE
  • Criação da Service Account do Spark (Adicionar role "Storage Admin")
  • Criação da imagem de container do spark-operator
  • Criação da imagem de container do notebook
  • Criação dos buckets para as camadas landing e silver

2 - Deploy Airflow

kubectl apply -f applications/airflow-prerequisites.yaml 

helm repo add apache-airflow https://airflow.apache.org

helm install airflow apache-airflow/airflow -f applications/airflow-values.yaml -n orchestrator 
  • Configurar a connection kubernetes_default
  • Cadastrar variável de ambiente combustiveis_source_urls

3 - Deploy do Spark Operator

kubectl apply -f applications/spark-operator-prerequisites.yaml

kubectl create secret generic gcp-credentials --from-file="./config/key.json" -n processing

helm repo add spark-operator https://googlecloudplatform.github.io/spark-on-k8s-operator

helm install spark-operator spark-operator/spark-operator -n processing

4 - Deploy Pyspark Notebook

Helm Chart para deploy do Pyspark Notebook no Kubernetes

kubectl create ns notebook

kubectl create secret generic gcp-credentials --from-file="./config/key.json" -n notebook

helm repo add pyspark-notebook https://a3data.github.io/pyspark-notebook-helm/

helm show values pyspark-notebook/pyspark-notebook  > applications/notebook-values.yaml

Modificações no arquivo applications/notebook-values.yaml:

  • Alterar a imagem: image.repository, image.tag
  • Descomentar credenciais GCP: env, extraVolumes, extraVolumeMounts
helm install pyspark-notebook pyspark-notebook/pyspark-notebook -f applications/notebook-values.yaml -n notebook

Recuperação do token para acesso

kubectl exec -it pod/pyspark-notebook-0 -n notebook -- bash

jupyter server list

About


Languages

Language:Jupyter Notebook 55.8%Language:Python 40.1%Language:Dockerfile 4.1%