{"id":42630128,"url":"https://github.com/anguslees/kubecfg","last_synced_at":"2026-01-29T05:17:35.939Z","repository":{"id":16900300,"uuid":"80833656","full_name":"anguslees/kubecfg","owner":"anguslees","description":"A tool for managing complex enterprise Kubernetes environments as code.","archived":false,"fork":false,"pushed_at":"2026-01-27T22:38:38.000Z","size":266,"stargazers_count":46,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-27T22:59:47.543Z","etag":null,"topics":["infrastructure","jsonnet","kubecfg","kubernetes","kubernetes-resources","workflow"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/anguslees.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-02-03T13:57:43.000Z","updated_at":"2026-01-27T11:02:16.000Z","dependencies_parsed_at":"2023-09-24T05:00:49.905Z","dependency_job_id":"e195c4e4-9d0b-4af2-b47e-827db478e00b","html_url":"https://github.com/anguslees/kubecfg","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/anguslees/kubecfg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anguslees%2Fkubecfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anguslees%2Fkubecfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anguslees%2Fkubecfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anguslees%2Fkubecfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anguslees","download_url":"https://codeload.github.com/anguslees/kubecfg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anguslees%2Fkubecfg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28863390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"online","status_checked_at":"2026-01-29T02:00:06.714Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["infrastructure","jsonnet","kubecfg","kubernetes","kubernetes-resources","workflow"],"created_at":"2026-01-29T05:17:35.274Z","updated_at":"2026-01-29T05:17:35.934Z","avatar_url":"https://github.com/anguslees.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubecfg\n\nA tool for managing complex enterprise Kubernetes environments as code.\n\n**Note: Effort on this project has moved to [ksonnet/kubecfg](https://github.com/ksonnet/kubecfg)** (a golang rewrite, hence I haven't just transferred this repo)\n\nkubecfg allows you to express the patterns across your infrastructure\nand reuse these powerful \"templates\" across many services.  The more\ncomplex you infrastructure is, the more you will gain from using\nkubecfg.\n\nStatus: Basic create/delete/update/diff functionality works, but there are\nstill some unimplemented features and arguments.  If the functionality you\nwant works now, it should continue to work going forward.\n\nYes, Google employees will recognise this as being very similar to a\nsimilarly-named internal tool ;)\n\n## Install\n\nPre-built x86_64 binaries are available in the\n[github releases page](https://github.com/anguslees/kubecfg/releases).\n\nInstall Rust and cargo.  See https://www.rust-lang.org/install.html\n\n```sh\n# `cargo install` installs here, without `--root` arg\nPATH=$PATH:$HOME/.cargo/bin\n\ncargo install --git https://github.com/anguslees/kubecfg.git\n```\n\n## Quickstart\n\n**kubecfg currently relies on a local `kubectl proxy` to access the\ncluster.** It defaults to `http://localhost:8001/` and doesn't support\nkubernetes authentication options (yet).\n\n```console\n% kubecfg proxy \u0026\n\n# Set kubecfg/jsonnet library search path.  Can also use `-J` args everywhere.\n% export KUBECFG_JPATH=$PWD/examples/lib\n\n# Show generated YAML\n% kubecfg show -f examples/squid.jsonnet -o yaml\n\n# Create squid (in namespace `squid`)\n% kubecfg create -f examples/squid.jsonnet\n\n# (modify squid.jsonnet)\n% sed -ie 's/port: 80,/port: 8080,/' examples/squid.jsonnet\n# Show differences vs the running job\n% kubecfg diff -f examples/squid.jsonnet\n# Update to new config\n% kubecfg update -f examples/squid.jsonnet\n```\n\n## Infrastructure-as-code Philosophy\n\nThe idea is to describe *as much as possible* about your configuration\nas files in version control (eg: git).\n\nYou make changes to the configuration and review, approve, merge, etc\nusing your regular code change workflow (github pull-requests,\nphabricator diffs, etc).  At any point, the config in version control\ncaptures the entire desired-state, so you can easily recreate the\nsystem in a QA cluster or recover from disaster.\n\nBecause the configuration is an absolute description (and not some\ncommands relative to a particular starting condition), you can\ncreate/recreate/upgrade *and downgrade* using the same description[1].\nIn particular, this means that recovering from a bad change is as\nsimple as reverting the change in version control and then updating\nthe cluster to the new (ie: old) configuration.\n\nThis is a big deal, with many advantages when maintaining complex\ninfrastructure with a team of people.  I encourage you to read more\ncomplete discussions of this topic elsewhere.\n\n[1] At least in most cases.  There are still situations involving\nschema changes to persistent data, etc that require manual care when\nchanging versions.\n\n### Recommended Automated Pipeline\n\nAn example ideal automated workflow with `kubecfg` using github and\nJenkins' multibranch pipeline plugin would be:\n\nOn each pull-request, run `kubecfg check -f $file` on every top-level\nfile.  Optionally, run `jsonnet fmt --test -f $file` if you want to\nenforce local code style guidelines.\n\nOn each integration into the `master` branch, run `kubecfg update\n--create --wait -f $file` on every top-level file.\n\n## Jsonnet\n\nKubecfg relies heavily on [jsonnet](http://jsonnet.org/) to describe\nKubernetes resources, and is really just a thin Kubernetes-specific\nwrapper around jsonnet evaluation.  You should read the jsonnet\ntutorial, and skim the functions available in the jsonnet `std`\nlibrary.\n\n### Why jsonnet?\n\nKubernetes configurations involve a lot of repeated patterns, and\ncomplex deployments will typically have their own local conventions on\ntop of that.  Jsonnet can import other files, has a strong \"merge\"\noperation, and carefully considered \"composition\" properties, which\nall allow for complex configurations to be managed without getting out\nof control.\n\nJsonnet allows configuration values to be derived from other\nconfiguration values, reducing duplication and avoiding configuration\nbecoming inconsistent.\n\nJsonnet contains an `assert` statement, and produces stack traces on\nerrors, allowing for faster local-turnaround when developing complex\nconfigurations.  Many trivial errors can be caught immediately without\nneeding to attempt a deployment.\n\nJsonnet natively produces JSON structures. This removes the quoting\nand indenting challenges from hybrid solutions like go-templated YAML.\n\n## Suggested jsonnet Repo Layout\n\nYou are welcome to use kubecfg/jsonnet in any way that works for you,\nand please tell others about it so they can learn from your\nexperience.\n\nMy suggested configuration layout is (below any particular\nsubdirectory):\n\n`/lib/*.libsonnet`: Jsonnet utility files that don't represent real\nKubernetes resources. `/lib` should be in `KUBECFG_JPATH` environment\nvariable (or explicit `-J` args).\n\n`/common/*.jsonnet`: A file for each major component of your\ninfrastructure, in the style of `examples/squid.jsonnet`.  Most of\nyour config is here.  In particular, note the idiom of ending each\nfile with a `kube.List() { ... }` construct.\n\n`/$cluster_name/*.jsonnet`: Specific instantiations of files in\n`/common/*.jsonnet` for each cluster.  These are your \"top-level\"\nfiles for each cluster.  These just import the \"common\" files and\nmerge any tweaks required for this specific cluster deployment (eg:\nproduction clusters might need more resources than testing, or a\ndifferent `--web.external-url` arg value, etc). These should be as\nthin as possible because (eg) anything specific to your production\ncluster isn't getting tested in your QA cluster.\n\nWith this structure, all `*.libsonnet` and `*.jsonnet` can be passed\nthrough `jsonnet fmt` and `jsonnet eval` lint checks (if desired).\nAll `*/*.jsonnet` files should be valid Kubernetes objects and satisfy\n`kubecfg check`.  The files in `$cluster/*.jsonnet` can be\nautomatically deployed to `$cluster` as appropriate for your workflow.\n\nNote in particular that in this structure the \"objects\" being passed\nfrom `kube.libsonnet` -\u003e `common` -\u003e `$cluster` are the actual\nKubernetes JSON objects and not some higher-level (and lossy)\nintermediate description.  This structure allows any Kubernetes option\nto be tweaked at any level in the \"inheritance\" tree, without having\nto\n[explicitly expose every option](https://github.com/kubernetes/charts/blob/master/stable/prometheus/values.yaml) or\nmake some options unavailable.  Embrace the merge operation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanguslees%2Fkubecfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanguslees%2Fkubecfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanguslees%2Fkubecfg/lists"}