Skip to content

Commit

Permalink
Merge pull request #1 from ratulSharker/adding-readme
Browse files Browse the repository at this point in the history
Adding readme, license and github action
  • Loading branch information
ratulSharker authored Nov 28, 2023
2 parents 86788bc + fab8e6f commit 7954259
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docker Image Push

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker compose build
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push to Docker hub
run: docker compose push
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ratul Sharker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[![Dev.to blog](https://img.shields.io/badge/dev.to-0A0A0A?style=for-the-badge&logo=dev.to&logoColor=white)](https://dev.to/ratulsharker/my-understanding-was-wrong-about-readiness-and-liveliness-probes-24n2-temp-slug-3425253?preview=739deda28dea342f9a7720b0667bfbe0b13f63061f3af1a1966ada1943bbd3e9d7366aeb1452485c3cb91319592e979d25ea055b13e44d91c721d294) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white) ![Kubernetes](https://img.shields.io/badge/kubernetes-%23326ce5.svg?style=for-the-badge&logo=kubernetes&logoColor=white) ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) [![Docker Image CI](https://github.com/ratulSharker/k8-probes/actions/workflows/docker-image-push.yml/badge.svg)](https://github.com/ratulSharker/k8-probes/actions/workflows/docker-image-push.yml)

# k8-probes

## Blog post:
This repository is better accompanied with the blog post [My understanding was wrong about readiness and liveliness probes](https://dev.to/ratulsharker/my-understanding-was-wrong-about-readiness-and-liveliness-probes-24n2-temp-slug-3425253?preview=739deda28dea342f9a7720b0667bfbe0b13f63061f3af1a1966ada1943bbd3e9d7366aeb1452485c3cb91319592e979d25ea055b13e44d91c721d294) and [killercoda.com](https://killercoda.com)

## Background:
For better availability of services, kubernetes offers three type of probes:

- Startup Probe.
- Readiness Probe.
- Liveliness Probe.

To accomodate exploring these probes, requires following:

- A simple rest service.
- Containerisation of the rest service.
- Kubernetes deployment definitions.

This repository covers all above points for exploring the kubernetes probes.

## Implementation details:

**Rest Service:**
- A simple nodejs + expressjs service.
- Exposed three routes `/liveliness`, `/readiness` & `/startup`.
- Each of these routes logs with timestamp.
- Each of these routes response code can be controlled via environment variables.

**Containersation:**
- Docker is used in containerisation of the rest service.
- Used [Dockerhub](https://hub.docker.com) to store the container image.
- `docker-compose.yaml` for local testing and image pushing into [Dockerhub](https://hub.docker.com).

**Kubernetes Deployment:**
- `playground` named namespace declared in the definition.
- Environments variables are configured for response codes for routes.
- Two different deployment files added, with `startup` probe and another without `startup` probe configured.

0 comments on commit 7954259

Please sign in to comment.