Code Monkey home page Code Monkey logo

otc-terraform-template's Introduction

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:

Please keep in mind this workshop just teaches the basics. For a proper and secure production setup please contact us at [email protected]

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
  • 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

otc-terraform-template's People

Contributors

oeotvos avatar

Watchers

 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.