{"id":19273704,"url":"https://github.com/yusufshakeel/learn-k8s","last_synced_at":"2026-05-04T10:32:05.168Z","repository":{"id":167278695,"uuid":"642810320","full_name":"yusufshakeel/learn-k8s","owner":"yusufshakeel","description":"This project is about learning Kubernetes.","archived":false,"fork":false,"pushed_at":"2024-02-01T15:24:03.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-05T14:25:14.988Z","etag":null,"topics":["deployment","docker","docker-image","google-cloud-platform","kubernetes","pods","replica-set"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/yusufshakeel/learn-k8s","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yusufshakeel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-19T11:53:36.000Z","updated_at":"2023-05-21T09:44:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"d634a920-ab36-471d-b7a0-05cb3e0cc7ce","html_url":"https://github.com/yusufshakeel/learn-k8s","commit_stats":null,"previous_names":["yusufshakeel/learn-k8s"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusufshakeel%2Flearn-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusufshakeel%2Flearn-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusufshakeel%2Flearn-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yusufshakeel%2Flearn-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yusufshakeel","download_url":"https://codeload.github.com/yusufshakeel/learn-k8s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240378871,"owners_count":19792039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","docker","docker-image","google-cloud-platform","kubernetes","pods","replica-set"],"created_at":"2024-11-09T20:43:52.476Z","updated_at":"2026-05-04T10:32:00.135Z","avatar_url":"https://github.com/yusufshakeel.png","language":"JavaScript","funding_links":["https://www.paypal.me/yusufshakeel"],"categories":[],"sub_categories":[],"readme":"# learn-k8s\nThis project is about learning Kubernetes.\n\n[![Build Status](https://github.com/yusufshakeel/learn-k8s/actions/workflows/ci.yml/badge.svg)](https://github.com/yusufshakeel/learn-k8s/actions/workflows/ci.yml)\n\n## Table of Content\n* [Prerequisite](#prerequisite)\n* [Getting started](#getting-started)\n* [Postman Collection](#postman-collection)\n* [Localhost server](#localhost-server)\n* [API endpoints](#api-endpoints)\n* [Docker Image](#docker-image)\n* [Docker Container in localhost](#docker-container-in-localhost)\n* [Tests](#tests)\n* [Kubernetes files](#kubernetes-files)\n\n## Prerequisite\n\nThis project depends on the following.\n\n* NodeJS (v14 or higher)\n* Docker (Optional. Needed only if you want to create docker image and run the project in a container.)\n\n## Getting started\n\nThis is a NodeJS project. To get started, first install all the packages by running the following command in the terminal.\n\n```shell\nnpm i\n```\n\n## Postman Collection\n\nCheck the `docs` folder.\n\n## Localhost server\n\nTo start the localhost server.\n\n```shell\nnpm run start\n```\n\n## API endpoints\n\nCheck out the `docs` folder. It has the Postman collection.\n\n### Home\n```\ncurl --location 'http://0.0.0.0:3000'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"Hello, World!\",\n        \"hostname\": \"Yusufs-MBP-2\"\n    }\n}\n```\n\n### Liveness\n\nUse this for **livenessProbe** in Kubernetes.\n\nWhen the app is live.\n\n```\ncurl --location 'http://0.0.0.0:3000/liveness'\n\nResponse: \nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am live!\"\n    }\n}\n```\n\nWhen the app is not live.\n\n```\ncurl --location 'http://0.0.0.0:3000/liveness'\n\nResponse:\nStatus: 500 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am not live!\"\n    }\n}\n```\n\n### Liveness: make unhealthy\n\nThis API will make the app liveness unhealthy. Pass the TTL in seconds.\n\n```\nRequest:\n{\n  \"data\": {\n    \"ttl\": 100\n  }\n}\n```\n\nDefault ttl: 60 seconds.\n\n```\ncurl --location --request PUT 'http://0.0.0.0:3000/liveness/make/unhealthy' \\\n--header 'Content-Type: application/json' \\\n--data '{\"data\":{\"ttl\": 10}}'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am unhealthy!\"\n    }\n}\n```\n\n### Readiness\n\nUse this for **readinessProbe** in Kubernetes.\n\nWhen the app is ready.\n\n```\ncurl --location 'http://0.0.0.0:3000/readiness'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am ready!\"\n    }\n}\n```\n\nWhen the app is not ready.\n\n```\ncurl --location 'http://0.0.0.0:3000/readiness'\n\nResponse:\nStatus: 500 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am not ready!\"\n    }\n}\n```\n\n### Readiness: make unhealthy\n\nThis API will make the app readiness unhealthy. Pass the TTL in seconds.\n\n```\nRequest:\n{\n  \"data\": {\n    \"ttl\": 100\n  }\n}\n```\n\nDefault ttl: 60 seconds.\n\n```\ncurl --location --request PUT 'http://0.0.0.0:3000/readiness/make/unhealthy' \\\n--header 'Content-Type: application/json' \\\n--data '{\"data\":{\"ttl\": 10}}'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"I am unhealthy!\"\n    }\n}\n```\n\n### Version\n```\ncurl --location 'http://0.0.0.0:3000/version'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"version\": \"0.1.0\"\n    }\n}\n```\n\nTo change the version set the environment variable APPLICATION_VERSION=`semver`.\n\nExample: `APPLICATION_VERSION=1.0.0`\n\n### Metadata\n```\ncurl --location 'http://0.0.0.0:3000/metadata'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"os\": \"darwin\",\n        \"hostname\": \"Yusufs-MacBook-Pro-2.local\",\n        \"uptime\": {\n            \"unit\": \"sec\",\n            \"quantity\": \"891910\"\n        },\n        \"memory\": {\n            \"unit\": \"bytes\",\n            \"quantity\": \"17179869184\"\n        },\n        \"cpus\": [\n            {\n                \"model\": \"Apple M1 Pro\",\n                \"speed\": 24,\n                \"times\": {\n                    \"user\": 99240520,\n                    \"nice\": 0,\n                    \"sys\": 57942390,\n                    \"idle\": 219834960,\n                    \"irq\": 0\n                }\n            }\n        ]\n    }\n}\n```\n\n### Die\n\nThis will kill the server, and it will not work anymore.\n\n```\ncurl --location --request POST 'http://0.0.0.0:3000/die'\n\nResponse:\nStatus: 200 Content-Type: application/json\nBody:\n{\n    \"data\": {\n        \"message\": \"Goodbye...\"\n    }\n}\n```\n\n### Metrics\n```\ncurl --location 'http://0.0.0.0:3000/metrics'\n\nResponse:\nStatus: 200 Content-Type: text/plain\nBody:\n# HELP process_cpu_user_seconds_total Total user CPU time spent in seconds.\n# TYPE process_cpu_user_seconds_total counter\nprocess_cpu_user_seconds_total 0.22259\n\nmore line follows...\n```\n\n## Tests\n\nTo run the test suite.\n\n```shell\nnpm run test\n```\n\n## Docker Image\n\nDockerHub link of this project [yusufshakeel/learn-k8s](https://hub.docker.com/r/yusufshakeel/learn-k8s)\n\nTo pull the image on your localhost.\n\n```shell\ndocker pull yusufshakeel/learn-k8s\n```\n\n## Docker Container in localhost\n\nTo run the docker container in localhost.\n\n```shell\ndocker run -d -p 3000:3000 yusufshakeel/learn-k8s\n```\n\nThis will start the server on port 3000.\n\n## Kubernetes files\n\nCheck the `k8s` folder for Kubernetes files.\n\n\n## License\n\nIt's free :smiley:\n\n[MIT License](https://github.com/yusufshakeel/learn-k8s/blob/main/LICENSE) Copyright (c) 2023 Yusuf Shakeel\n\n## Donate\n\nFeeling generous :smiley: [Donate via PayPal](https://www.paypal.me/yusufshakeel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusufshakeel%2Flearn-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyusufshakeel%2Flearn-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyusufshakeel%2Flearn-k8s/lists"}