Giter Club home page Giter Club logo

terraforming-kuerbnetes's Introduction

Terraforming Kubernetes

What if starting a remote virtual machine instance was as simple as changing a number on a document and running a command? That is how simple terraform can be and why it's so powerful.

Using documents to change what server we need running is a feature of Infrastructure as Code and can be a paradigm shift for many developers since it's so simple yet effective. One of the biggest advantages of IaC and terraform: version control and CI/CD pipeline automation.

Terraform will turn on (and off) the servers we need. Kubernetes will manage how we allocate the resources on those servers to run the applications we want and need. The pair is a juggernaut of automation. This post will teach you exactly what to do to use them both.

Using this Repo

Clone Repo

git clone https://github.com/codingforentrepreneurs/terraforming-kubernetes
cd terraforming-kubernetes

Create Linode API Key

  1. Get an account with a $100 credit here
  2. Create an API Personal Access Key on Linode here
echo "linode_api_token=\"YOUR_API_KEY\"" >> devops/terraform.tfvars

Configure Cloud-based Terraform State on a Object Storage Bucket

  1. Create an Object Storage Bucket
  2. Create an Access Key for Object Storage
  3. Update the terraform backend.

Below is an example backend that you need to modify to fit your Object Storage bucket. This backend will store your Terraform statefiles in Object Storage instead of locally.

In devops/backend add:

skip_credentials_validation=true
skip_region_validation=true
bucket="YOUR_CUSTOM_OBJECT_STORAGE_BUCKET_NAME"
key="terraforming-kubernetes.tfstate"
region="us-southeast-1"
endpoint="us-southeast-1.linodeobjects.com"
access_key="YOUR_CUSTOM_S3_ACCESS_KEY"
secret_key="YOUR_CUSTOM_S3_SECRET_KEY"

Replace:

  • YOUR_CUSTOM_OBJECT_STORAGE_BUCKET_NAME with the bucket you created
  • YOUR_CUSTOM_S3_ACCESS_KEY and YOUR_CUSTOM_S3_SECRET_KEY with the object storage access keys you created
  • Replace any other attributes to fit your specific bucket and project (i.e. region, endpoint, key)

Terraform commands

terraform -chdir=./devops init --backend-config=backend
terraform -chdir=./devops apply

After running apply, type yes to agree.

Kubernetes Commands

Once Terraform completes, the relative folder .kube will be created with a kubeconfig.yaml file that you can use. If you're on VSCode, your KUBECONFIG environment variable will already be set for you so you can:

kubecl get nodes

terraforming-kuerbnetes's People

Contributors

codingforentrepreneurs avatar jmitchel3 avatar tarek421995 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.