Skip to content

Amirbekyan/devops-task

Repository files navigation

devops-task

DevOps Engineer Task

Setup Instructions

The below instructions are compatibe with and tested on Debian 13.

Use the automated setup script or proceed with manual setup described below:

curl -sL https://raw.githubusercontent.com/Amirbekyan/devops-task/refs/heads/main/src/setup.sh | sudo bash

Manual setup

  1. Install git and ansible
apt update && apt upgrade -y
apt install -y git ansible
  1. Clone this repo:
git clone https://github.com/Amirbekyan/devops-task.git
cd devops-task
  1. Install prerequisites:
ansible-playbook -i localhost src/ansible-minikube.yml
  1. Run Terraform code:

Important

Copy terraform.tfvars.sample to terraform-tfvars and update values with real ones before applying the code.

Tip

Webhook.site can be used to generate temporary webhook URLs for testing. GitHub credentials are optional for this repo as it's public.

tofu init
tofu apply
  1. Pre-build devops-task local image tags alpha and bravo for CD demo:
ansible-playbook -i localhost src/ansible-docker-build.yml
  1. Add records for ingress hostnames in /etc/hosts to point to Minikube host address:
<host-ip>	preview.hello.devops-task hello.devops-task argocd.devops-task grafana.devops-task alert.devops-task prometheus.devops-task

Congratulations! You've successfully set up the devops-task environment.

Usage

Here are the endpoints we've setup so far:

  • Grafana Grafana visualizes metrics, logs and traces, checkout:

    • Dashboards for metrics
    • Explore or Dilldown for logs and traces

    grafana dashboard

  • Prometheus Prometheus is used to collect and store metrics, as well as triggering alerts, checkout 'Alerts' page for configured alerts.

    rules

    The screenshot above shows that an alert will be triggered each time percentage of 4xx requests exceeds 5% of all requests.

  • Alert Manager Alert Manager handles alerts routing and notifications.

    alerts notifications

  • ArgoCD We'll use ArgoCD to deploy our Sample App to Minikube in the next step. ArgoCD will send alerts to the same channels as Alert Manager in case of application creation, updates, degradation, deletion and sync issues.

  • Sample App

  • Sample App new version preview Sample App current (and preview - in case of Rollout) home pages

Head to ArgoCD page and create an app with this params:

  • applicaton name: <name-of-your-choice>
  • project name: default
  • sync policy: Automatic
  • sync options: Auto-Create Namespace
  • repository url: https://github.com/amirbekyan/devops-task.git
  • revision: HEAD
  • path: app/chart/olleh
  • cluster url: https://kubernetes.default.svc
  • namespace: <namespace-of-your-choice>
  • parameters:
    • image.tag: alpha
    • ingress.enabled: true
    • rollout.enabled: true
    • replicaCount: 3
project: default
source:
  repoURL: https://github.com/amirbekyan/devops-task.git
  path: app/chart/olleh
  targetRevision: HEAD
  helm:
    parameters:
      - name: replicaCount
        value: '3'
      - name: ingress.enabled
        value: 'true'
      - name: rollout.enabled
        value: 'true'
      - name: image.tag
        value: alpha
destination:
  server: https://kubernetes.default.svc
  namespace: olleh
syncPolicy:
  automated: {}
  syncOptions:
    - CreateNamespace=true

This will create an Argo Rollout runnin 3 instances of our sample app.

olleh

alpha alpha-preview

We can check if the logs and traces show up in Grafana:

logs logstotraces traces servicemap

Let's now update the image tag to bravo:

update

It'll create another replicaset, replicas of which are available through the preview service and ingress:

rollout

alpha bravo-preview

Our strategy is designed to pause the promotion to the newer version, so once the new replicaset is healthy, we'll be able to promote or drop the new version.

promote

After full promotion, the new version will be available under http://hello.devops-task:32080/

bravo

Note

Initially I planned to setup Argo Events and Argo Workflows to build the sample app images continuously on the Minikube itself. Unfortunately I was short in time due to my travel to US to attend KubeCon & CloudNativeCon NA 2025. So I decided to mock the CI part with an Ansible playbook instead. Peachy greetings from Atlanta 🍑🙂.

About

DevOps Engineer Task

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published