Coder Social home page Coder Social logo

ycetindil / phonebook-azure-aks-githubactions-kubernetes-terraform Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 62 KB

HCL 22.03% Dockerfile 1.10% Python 42.27% HTML 34.61%
aks azure docker dockerfile github-actions kubernetes phonebook terraform azurekubernetesservice

phonebook-azure-aks-githubactions-kubernetes-terraform's Introduction

Phonebook Application Deployed on AKS Using GitHub Actions

This project sets up a CI/CD pipeline using GitHub Actions to deploy infrastructure using Terraform and deploy Phonebook Application to that infrastructure.

Setting Credentials

Terraform needs Azure Credentials to create the infrastructure. We need to provide these values in environment for Terraform to look up.

  • ARM_SUBSCRIPTION_ID
  • ARM_TENANT_ID
  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET

To get these credentials we use this command in a terminal;

az ad sp create-for-rbac --sdk-auth --role="Contributor" --scopes="/subscriptions/<subscription_id>"

Terraform also needs GitHub Token to create the variables in GitHub repository. We provide the token securely by defining it in the GitHub Actions secrets as GH_TOKEN. We assign this value in the pipeline environment section to GITHUB_TOKEN with:

GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

az login and k8s deployment use AZURE_CREDENTIALS which is also defined as a repo secret.

Notes

  • Since GitHub Actions Pipeline uses an ephemeral agent we need to define a backend to keep our terraform.tfstate.
  • To use later in the pipeline we define multiple github_actions_variables.
  • Since we have our Terraform configuration files in a dedicated folder, we need to define this path in the job environment for the steps which need to access to this folder to run. In a similar fashion we need to define k8s path to apply our Kubernetes manifest files.
  • Our application needs the ports 30001-30002 open to be accessed. Since the NSG name of the AKS assigned randomly by Azure we assign it to a GitHub variable and add a rule to it in the pipeline.

phonebook-azure-aks-githubactions-kubernetes-terraform's People

Contributors

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