Skip to content

Конфігурація Terraform для розгортання тестового додатку kbot на GKE за допомогою Flux

Notifications You must be signed in to change notification settings

yevgen-grytsay/kbot-tf-flux

Repository files navigation

Components

  • Google Cloud Provider (GCP)
  • Terraform (flux, google)
  • Flux (CRD: GitRepository, HelmRelease)
  • Kubernetes (Google Kubernetes Engine)
  • application repository (contains helm chart, code and CI/CD configuration) (github.com)
  • infrastructure repository (contains terraform config and flux config) (github.com)
  • CI/CD (GitHub Actions)
  • Container Registry (ghcr.io)

Flux

Deployment

graph LR
User -- 1. push --> AppRepository

Flux -- 2. poll --> AppRepository
%%Terraform -- use --> InfraRepository
Flux -- 3. deploy --> App
%%Terraform -- apply --> Flux
%%Terraform -- save state --> GoogleCloudStorage

kubelet -- 4. download --> ContainerRegistry

subgraph GitHub
    AppRepository
    %%InfraRepository
    ContainerRegistry
end

subgraph KubernetesCluster
    Flux
    
    subgraph kubelet
        App
    end
end
Loading

App Infrastructure Sync

graph LR
User -- 1. push --> InfraRepository

Flux -- 2. poll --> InfraRepository

Flux -- 3. reconcile --> AppNamespace

subgraph GitHub
    InfraRepository
end

subgraph KubernetesCluster
    Flux
    subgraph AppNamespace
        App
    end
end
Loading

Setup

gcloud auth application-default login --project=PROJECT_ID

# OR
# gcloud auth application-default login
# gcloud config set project PROJECT_ID
read -s TELE_TOKEN_RAW
export TELE_TOKEN_RAW

TELE_TOKEN=$(echo $TELE_TOKEN_RAW | tr -d '\n' | base64)
export TELE_TOKEN

envsubst '$TELE_TOKEN' < helm-values.tpl.yaml > helm-values.yaml

kubectl create secret generic kbot-helm-values \
    --namespace=kbot-tf-flux \
	--from-file=values.yaml=./helm-values.yaml

terraform apply -var-file="vars.tfvars"

# gcloud container clusters get-credentials kbot --location=<location>

Resources

About

Конфігурація Terraform для розгортання тестового додатку kbot на GKE за допомогою Flux

Topics

Resources

Stars

Watchers

Forks

Languages