Skip to content

ognevsd/momo-infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

momo-infrastructure

Note

Application and supporting services are currently not deployed

Main Services

Project structure

├── kubernetes
│   ├── argo
│   ├── backend
│   ├── certificate
│   └── frontend
├── momo-chart
│   └── charts
│       ├── backend
│       │   └── templates
│       └── frontend
│           └── templates
├── monitoring
│   ├── alertmanager
│   │   └── templates
│   ├── grafana
│   │   ├── dashboards
│   │   └── templates
│   └── prometheus
│       ├── rules
│       └── templates
├── terraform-k8s
└── terraform-s3
  1. kubernetes
    1. argo - manifest for Argo ingress
    2. backend - manifests to deploy backend
    3. certificate - manifests for automatic issue and update of TLS certificate
    4. frontend - manifests to deploy frontend
  2. momo-chart - Helm charts that are used by Argo to deloy the application
  3. monitoring - Charts for monitoring services
  4. terraform-k8s - IaC files for creating manages k8s in Yandex Cloud
  5. terraform-s3 - IaC for creating S3-like object storage in Yandex Cloud

Deploying

Creating k8s cluster

  1. Install yc CLI and login
  2. Get token:
yc config list
  1. Add token to env variable
export YC_TOKEN=<your token>
  1. Navigate to terraform-k8s
  2. Run following commands
terraform init
terraform plan
terraform apply

Creating Object Storage

  1. Navigate to terraform-s3
  2. Run following commands
terraform init
terraform plan
terraform apply

Cert-manager

For TLS certificate from Let's Encrypt, Cart-Manager and DNS01-challenge are used. As a result, wildcard-certificate for all domens under *.sergeyognev.com will be received. Cloudflare will be acting as DNS-provider.

  1. Install cert-manager
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cert-manager.yaml
  1. Check that cert-manager is installed correctly
kubectl get pods --namespace cert-manager
  1. Receive Cloudflare API token from Cloudflare, add it to kubernetes/certificate/cloudflare-api-token.yaml and create a secret. Token should have following permissions:

cloudflare_token

kubectl apply -f cloudflare-api-token.yaml

stringData field is used in the secret, so token should be added as plain text without base64 encoding

  1. Install cluster issuer
kubectl apply -f clusterissuer-prod.yaml

It is recommended to first install the staging cluster issuer to avoid exceeding Let’s Encrypt limits. If the test is successful, replace staging with prod.

  1. Check cluster issuer
kubectl get clusterissuer
kubectl describe clusterissuer <name>
  1. Add wildcard certificate
kubectl apply -f wildcard-certificate.yaml
  1. Check certificate
kubectl get certificate
  1. To troubleshoot bugs, review the test log (if necessary).
kubect describe challenge

Install ArgoCD

  1. Install ArgoCD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  1. Create Ingress for ArgoCD
kubectl apply -f argo/argo-ingress.yaml
  1. Copy the certificate from the default namespace to the argocd namespace (the simplest method that came to mind):
    1. Output the certificate to the console.
    2. Copy all the data into a new yaml file.
    3. Change the namespace in the file.
    4. Create a secret in the new namespace.
kubectl get secret sergeyognev-com-tls -oyaml
  1. Create default password for ArgoCD
argocd admin initial-password -n argocd
  1. Register via CLI
argocd login argocd.sergeyognev.com
  1. Add your cluster
argocd cluster add <context name> --server argocd.sergeyognev.com

Deploy app

  1. Add your repo to ArgoCD
  2. Install application, using Helm-chart
  3. Following result is expected

ArgoCD

Install monitoring and logging systems

  1. Navigate to monitoring dorectory
  2. Install ClusterRoleBinging for Prometheus (to see data from application)
kubectl apply -f access.yaml
  1. Install Prometheus
helm upgrade --atomic --install prometheus prometheus 
  1. Install Grafana
helm upgrade --atomic --install grafana grafana 
  1. Install Loki
helm install --values loki.yaml loki grafana/loki
  1. Install Promtail
helm upgrade --install promtail grafana/promtail

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published