Giter Club home page Giter Club logo

k8s-gcp-terraform's Introduction

Simple K8s cluster in GCP with Helm chart demo deployment

Readme.md contains prerequisits on how to setup the environment, and information on how to add additional microservices helm charts.

Prerequisits

  • Google Authentication/Credentials
    brew cask install google-cloud-sdk
  • credentials.json file in the repository root.
  • Terraform 12
    brew install terraform
  • Helm 3 brew install helm

Infrastructure default values

Open terraform.tfvars and change the values according to the needs.

Infrastructure commands

Change directory to k8s-cluster

# Install terraform providers
terraform init

# Check for infrastructure deployment/changes
terraform plan

# Deploy infrastructure
terraform apply

Microservice - Helm charts

Helm is used to generate the skeleton for the microservices. This could also be done through Terraform as shown in helm.tf.

Decision is made to generate this outside of terraform using Helm as in my experience Developers should be able to make changes. These files charts are also stored outside of the gitrepo on dockerhub, artifactory or similar tools.

Create new microservice

Change to the root of the repository

helm create <service name>

Open values.yaml and provide image name:

repository: nginxdemos/hello:latest

Additional changes made,

  • Change service type to NodePort.
  • Enabled ingress, change value to true.

Open deployment.yaml and add deployment strategie:

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 1
    maxUnavailable: 1

Open values.yaml and define resources limnit:

resources:
  limits:
    cpu: 100m
    memory: 128Mi
  requests:
    cpu: 100m
    memory: 128Mi

k8s-gcp-terraform's People

Contributors

ahamade-mobiquity avatar ahmad-hamade avatar

Watchers

 avatar  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.