Skip to content

mprantl/otc-terraform-template

Repository files navigation

Blueprint for iits OTC GitOps

Introduction

During this Workshop/Blueprint you will learn the basics about proper automation of infrastructere and how to bootstrap ArgoCD. A similar Approach also applies to FluxCD.

Here is what we want to achieve:

big-picture.png

admin-dashboard.png

The following services we will deploy later

  • Admin Dashboard
  • Basic Auth Gateway
  • Storage Classes
  • Elastic Stack (kibana/elasticsearch/filebeat)
  • Kyverno

Please keep in mind this workshop just teaches the basics. For a proper and secure production setup please contact us at kontakt@iits-consulting.de

Tools Requirements

  • Install Terraform in the Version 1.3.5. We would recommend to use the tool tfenv
  • Install otc-auth. We need to it to be able to login over CLI and getting the kube config
  • A proper Shell. If you are using Windows please use GitBash
  • kubectl cli
  • jq
  • git
  • Github Account

Preparation & Requirements

  1. Please go to this site: https://github.com/iits-consulting/otc-terraform-template and click on Use this template github-use-template.png
  • Click on Create a new repository and then select Include all branches and private repo include-branches.png
  1. Next step is to do the same as in Step 1 with this project: https://github.com/iits-consulting/otc-infrastructure-charts-template

  2. Create now a Github Access Token of your Fork for the repo from step 2. It is needed for ArgoCD to be able to pull information from there

    • Click here to do that
    • Select Only select repositories and choose your fork of the infrastructure-charts
    • The token should be able to see branches and pull from the repo
  3. You should have got an E-Mail with your credentials the format looks like this

    credentials.png

  4. Login here: https://auth.otc.t-systems.com/authui/login.action and set a proper password

  5. Docker Account

    • To avoid the docker rate limit problem you need to create a docker.io account first or use your existing credentials/token. If you don't have a docker account you can create a free one here
  6. Adjust the .envrc file. The .envrc is needed to set environment variables which are used by terraform or by the otc-auth cli tool

    • replace all "REPLACE_ME" Placeholder with the correct values
    • source the updated .envrc file like this "source .envrc"

Create a remote state bucket

First thing we create is a remote OBS/S3 Bucket. Within this bucket we store the current state of the OTC infrastructure which we will create.

  1. Go to the folder terraform-remote-state-bucket-creation and execute terraform init and apply
  2. The output from terraform should look like this: terraform-output-remote-state.png
  3. Add the remote state configuration under:
    • ./otc-cloud/dev/settings.tf
    • ./otc-cloud/dev/kubernetes/settings.tf

Create the kubernetes cluster and other infrastructure components

  1. Go into the folder otc-cloud/dev

Validate your setup is up and running

  • Check Kubernetes
    • source the file otc-cloud/dev/stage-dependent-env.sh

    • the output should look like this:kubect-fetched.png

    • execute inside your cli the following command:

      kubectl get nodes
  • Check DNS
    • execute inside your cli the following command:
    nslookup $TF_VAR_domain_name 
    • It should point to some 80...* Address

Congrats your infrastructure is working properly

Bootstrap ArgoCD

Now we want to bring some life into our cluster. For that we will deploy everything from our Fork from the Preparation & Requirements Step 5

  • Go into the folder ./otc-cloud/dev/kubernetes
  • Take a look at the main.tf and try to understand what we want to achieve
  • Execute Terraform init and apply
  • ArgoCD should slowly start to boot and after around 3-4 Minutes it should be finished

Access ArgoCD UI

First we will access ArgoCD over a kubectl port-forward. To do that execute the following commands in your cli:

# This command will make the argo command available
source shell-helper.sh
# Opens a tunnel to your kubernetes cluster and exposes ArgoCD under http://localhost:8080/argocd
# It will print out the Username and the Password on the first line and the browser should open automatically.
argo

Go over to Argo and deploy some services

We are finished with the terraform part and will switch now over to this repository: https://github.com/iits-consulting/otc-infrastructure-charts-template

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published