{"id":18820681,"url":"https://github.com/valentinfunk/kubernetes-deployment-tool","last_synced_at":"2025-04-13T23:34:15.168Z","repository":{"id":76050550,"uuid":"62952339","full_name":"ValentinFunk/kubernetes-deployment-tool","owner":"ValentinFunk","description":"Script for easily deploying microservices into kubernetes and tracking deployment status. ","archived":false,"fork":false,"pushed_at":"2017-06-22T06:24:33.000Z","size":11,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T14:08:23.089Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValentinFunk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-07-09T14:08:19.000Z","updated_at":"2018-03-03T09:15:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"35536eab-f604-44e1-a15f-762b94c162fd","html_url":"https://github.com/ValentinFunk/kubernetes-deployment-tool","commit_stats":null,"previous_names":["valentinfunk/kubernetes-deployment-tool"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinFunk%2Fkubernetes-deployment-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinFunk%2Fkubernetes-deployment-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinFunk%2Fkubernetes-deployment-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinFunk%2Fkubernetes-deployment-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValentinFunk","download_url":"https://codeload.github.com/ValentinFunk/kubernetes-deployment-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248797944,"owners_count":21163213,"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":[],"created_at":"2024-11-08T00:29:29.868Z","updated_at":"2025-04-13T23:34:15.147Z","avatar_url":"https://github.com/ValentinFunk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Deployment Helper\n\nThis script helps you __deploy microservices into Kubernetes__. It monitors the Deployment, waits until it is truly finished (Services are available) and performs a Rollback on failure. \n\nIt is called like this:\n```\ncat deployment.yaml | node index.js \n```\nThe deployment.yaml file should contain service and deployment definitions.\n\n## How it works\n\n1. The current versions of all active deployments are fetched.\n2. `kubectl apply` is called to apply changes. For deployments kubectl rollout status is called to wait until replicasets have been updated.\n3. The new versions of all applied deployments are fetched and compared to the versions from step 1 to find out which have been changed.\n4. The cluster is polled to wait until the desired amount of replicas is available (`deployment.status.availableReplicas == deployment.spec.replicas`)\n5. For each service that was included in the applied YAML: 1) Pods are polled and it waits until at least one is healthy \u0026 ready (readinessProbe passed) 2) If `service.spec.type == \"LoadBalancer\"` the script waits until the Load Balancer has been created and an external endpoint is available\n6. a) If a failure is detected in step 4 or 5 (or the checks have timed out after the specified interval) all changed deployments are rolled back via `kubectl rollout undo`.\n   \n   b) If the deployment was successful, deployments that were changed (c.f. step 3) are written to deployments.txt (one deployment per line). At this stage you could run your e2e tests and use `kubectl rollout undo` if they fail.\n\n## Setup \nThe script calls kubectl processes instead of using the API, so simply configure a kubectl in the path. \n\nAdditional, optional configuration via Environment Variables:\n- `DEPLOY_WAIT_TIMEOUT` (default 120): Timeout in s for the changing of ReplicaSets.\n- `REPLICA_WAIT_TIMEOUT` (default 120): Timeout in s for reaching the desired amount of Replicas. \n- `SERVICE_READY_TIMEOUT` (default 120): Timeout in s for waiting until a Service is ready.\n- `KUBE_NAMESPACE`: Namespace to use. Uses the one configured with the current context via kubectl if not defined.\n\n## Example\n\nIn this example the products-service deployment was updated:\n```\ncat target-state.yaml | node index.js \nCalling kubectl to apply changes...\n[KUBECTL] service/mongodb\n[KUBECTL] deployment/mongodb\n[KUBECTL] service/products-service\n[KUBECTL] configmap/products-service-config\n[KUBECTL] deployment/products-service\n[KUBECTL] service/mysql\n[KUBECTL] secret/mysql-pass\n[KUBECTL] deployment/mysql\n[KUBECTL] service/users-service\n[KUBECTL] deployment/users-service\n[KUBECTL] configmap/service-endpoints\n[KUBECTL] service/web-service\n[KUBECTL] deployment/web-service\nWaiting until deployments mongodb, products-service, mysql, users-service, web-service have been applied.\nAll deployments have been rolled out. Fetching changes...\n        mongodb UNCHANGED\n        mysql UNCHANGED\n        products-service V 10 =\u003e 12\n        users-service UNCHANGED\n        web-service UNCHANGED\n        products-service replicas updated (1 replicas)\nWaiting for services to become available...\n        products-service running \u0026 ready\n        mysql running \u0026 ready\n        mongodb running \u0026 ready\n        web-service running \u0026 ready\n        users-service running \u0026 ready\nWaiting for endpoints to become available...\n        mongodb at ClusterIP(10.115.247.255)\n        mysql at ClusterIP(10.115.241.2)\n        web-service at 146.138.25.181\n        products-service at 120.211.81.47\n        users-service at 104.157.69.189\nDeployment Successful, writing deployments.txt...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinfunk%2Fkubernetes-deployment-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinfunk%2Fkubernetes-deployment-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinfunk%2Fkubernetes-deployment-tool/lists"}