{"id":23380568,"url":"https://github.com/flix-tech/kube-deployer","last_synced_at":"2025-09-16T09:48:30.712Z","repository":{"id":149086180,"uuid":"111924233","full_name":"flix-tech/kube-deployer","owner":"flix-tech","description":"Render \u0026 deploy kubernetes definitions","archived":false,"fork":false,"pushed_at":"2023-07-03T14:20:01.000Z","size":32,"stargazers_count":8,"open_issues_count":3,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T19:39:51.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flix-tech.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":"2017-11-24T13:58:44.000Z","updated_at":"2023-07-03T14:20:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"d618a7e2-dc05-48c7-907e-d7d300247d17","html_url":"https://github.com/flix-tech/kube-deployer","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fkube-deployer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fkube-deployer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fkube-deployer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fkube-deployer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flix-tech","download_url":"https://codeload.github.com/flix-tech/kube-deployer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312190,"owners_count":21082637,"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-12-21T20:16:49.249Z","updated_at":"2025-09-16T09:48:25.657Z","avatar_url":"https://github.com/flix-tech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://travis-ci.org/flix-tech/kube-deployer.svg?branch=master)\n\n\nKube Deployer adds templating and multi-branch environments to your K8S deployments, \nreduces your project overhead and takes care of cleaning up merged branches.\n\nIf you want templating in your Kubernetes files and/or multi branch support please continue reading.\n\nHow to use\n\nGo see all available commands please run:\n\n```\n$: kube-deploy -h\n```\n\nA Docker image with kubectl 1.7.7 is available here: https://hub.docker.com/r/flixtech/kube-deployer/\n\n## Templating\n\nInternally kube-deployer uses the handlebars v3 templating engine.\n\nInside the template you have access to a \"context\" variable of type RenderContext.\n\n```\ntype RenderContext struct {\n    Containers   map[string]RenderContextContainer\n    Objects      map[string]map[string]RenderContextEnvAwareObject\n    Env          string // url slugged\n    Namespace    string\n    DeployerSpec DeployerSpec\n}\n\ntype RenderContextContainer struct {\n    Name  string\n}\n\ntype RenderContextEnvAwareObject struct {\n    Name string\n}\n\ntype DeployerSpec struct {\n    ProjectDir string\n    TagVersion string\n    Env        string\n    Namespace  string\n    Containers []DeployerSpecContainer\n    Templates  []string\n    Cluster    DeployerSpecCluster\n}\n\ntype DeployerSpecCluster struct {\n    Host  string\n    Token string\n}\n\ntype DeployerSpecContainer struct {\n    Id    string\n    Image string\n}\n\n```\n\nIf you name a container \"php\" as id, then you reference it in your template like this:\n\n```\napiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n    name: foo-web\n    labels:\n        app: foo-web\nspec:\n    replicas: 1\n    template:\n        metadata:\n        labels:\n            app: foo-web\n        spec:\n            containers:\n                - name: php\n                  image: \"{{ context.containers.php.name }}\"\n...\n```\n\n# Multi env deployments\n\nkube-deployer is changing the metadata.name of all objects to include the env you passed.\n\n\nTo get the final object name you can access the context.objects map. (Templating is case sensitive)\n\n```\n{{ context.objects.{kind}.{original-metadata-name}.name }}\n\n// kind must be a valid k8s object (Service|Deployment|...)\n\nExample:\n\nvolumes:\n  - name: db-volume\n    persistentVolumeClaim:\n      claimName: '{{ context.objects.PersistentVolumeClaim.foo-pvc.name }}'\n```\n\n   \n## Provide a Kube Access Token\n\nEither set the KUBE_TOKEN env variable or pass the token via the -token=xxx flag.\n   \n## Dry Run \u0026 Verbose\n\nTo debug locally you can pass the --dry-run and --verbose flag.\n\n```\n$: kube-deploy deploy ... --dry-run --verbose\n```\n\n## No config file mode\n\nIn the \"no-config-file\" mode you need to pass all information like api host, templates, containers as cli arguments.\n\nFollowing arguments are requiered:\n* template (string list)\n* containers (string list in format \u003cid\u003e:\u003cregistry/image\u003e the id is a key chosen by  you)\n* server (api host of the cluster)\n\n```\n$: kube-deploy deploy \\\n    -env=production \\\n    -branch=master \\\n    -tag=1.4.5 \\\n    -namespace=staging-foo \\\n    -template=./kubernetes/staging/web.yml \\\n    -template=./kubernetes/staging/db.yml \\\n    -server=https://foo.k8s.io \\\n    -container=php:foo/bar\n```\n\n## Config file mode\n\nYou can place a .kube-deploy.yml file in your project and store multiple cluster data and targets and choose based on the -cluster and -namespace cli flag.\n \nExample:\n\n```    \nversion: 1\n\ncontainers:\n    - id: \"php\"\n      image: \"foo/bar\"\n\nclusters:\n    de_cluster:\n        host: https://foo.k8s.bar.io\n        targets:\n            - namespace: staging-foo\n              templates:\n                - \"./kubernetes/staging/web.yml\"\n                - \"./kubernetes/staging/db.yml\"\n                - \"./kubernetes/staging/pvc.yml\"\n                - \"./kubernetes/staging/consumer.yml\"\n            - namespace: prod-foo\n              templates:\n                - \"./kubernetes/prod/web.yml\"\n                - \"./kubernetes/prod/qa.yml\"\n                - \"./kubernetes/prod/consumer.yml\"\n                - \"./kubernetes/prod/crons.yml\"\n```\n\nThe -cluster flag is required when running with config file\n\n```\n$: kube-deploy deploy \\\n    -env=prod \\\n    -branch=master \\\n    -tag=1.4.5 \\\n    -namespace=staging-foo \\\n    -cluster=de_cluster\n```\n\t\n## Running outside of your project directory\n\nWhen running kube-deploy outside of your project directory you will need to provide the absolute path via the -project-dir flag\n\n```\n$: kube-deploy deploy ... -project-dir=/user/app\n```\n\n## Only render the templates\n\nIf don't want to use the internal \"kubectl apply\" command from kube-deployer you can run the \"render\" command.\n\nFor help run: `kube-deploy render -h`\n\nIt takes the same arguments (without token, verbose, dry-run because they are not needed for rendering) which will work the same as the \"deploy\" command but it will output the rendered template on STDOUT.\n    \nThis way you can do further manipulation or customize the kubectl apply call with your needs.\n\n## Gitlab CI usage\n\nHere is an example of how to multi-branch-deploy from gitlab-ci.\n\n```\n# deploy on branch pushes\ndeploy-staging-branch:\n  image: flixtech/kube-deployer:latest\n  script: \u003e\n    kube-deploy\n    deploy\n    -branch=$CI_BUILD_REF_NAME\n    -env=$CI_BUILD_REF_NAME\n    -tag=$CI_PIPELINE_ID\n    -namespace=staging-foo\n    -cluster=de_cluster\n  stage: deploy\n  only:\n    - branches\n  except:\n    - master\n\n# deploy latest master to static-1 and static-2 staging env\ndeploy-sandbox-branch:\n  image: flixtech/kube-deployer:latest\n  script:\n\t- kube-deploy deploy \\\n\t    -branch=master \\\n\t    -env=static-1 \\\n\t    -tag=$CI_PIPELINE_ID \\\n\t    -namespace=staging-foo \\\n\t    -cluster=de_cluster\n\t- kube-deploy deploy \\\n\t    -branch=master \\\n\t    -env=static-2 \\\n\t    -tag=$CI_PIPELINE_ID \\\n\t    -namespace=staging-foo \\\n\t    -cluster=de_cluster\n  stage: deploy\n  only:\n    - master\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflix-tech%2Fkube-deployer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflix-tech%2Fkube-deployer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflix-tech%2Fkube-deployer/lists"}