Skip to content
A tool for managing complex enterprise Kubernetes environments as code.
Branch: master
Clone or download
anguslees Merge pull request #244 from anguslees/clientgo10
Update client-go to 10.0 (aka kubernetes 1.13)
Latest commit 3478656 Mar 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Merge pull request #244 from anguslees/clientgo10 Mar 6, 2019
examples Value for REDIS_MASTER_PORT_NUMBER must be a string literal. Jun 5, 2018
integration Update client-go to 10.0 (aka kubernetes 1.13) Mar 6, 2019
lib Add travis test that verifies `go generate` has been run May 31, 2018
pkg/kubecfg Update client-go to 10.0 (aka kubernetes 1.13) Mar 6, 2019
testdata Update to go-jsonnet 0.12.1 Jan 17, 2019
utils Merge pull request #244 from anguslees/clientgo10 Mar 6, 2019
vendor Update client-go to 10.0 (aka kubernetes 1.13) Mar 6, 2019
.gitignore Initial version. Implements 'show' May 12, 2017
.travis.yml
CONTRIBUTING.md Apply suggestions from code review Feb 5, 2019
LICENSE Initial commit May 12, 2017
Makefile
README.md
go.mod
go.sum
main.go

README.md

kubecfg

Build Status Go Report Card

A tool for managing Kubernetes resources as code.

kubecfg allows you to express the patterns across your infrastructure and reuse these powerful "templates" across many services, and then manage those templates as files in version control. The more complex your infrastructure is, the more you will gain from using kubecfg.

Yes, Google employees will recognise this as being very similar to a similarly-named internal tool ;)

Install

Pre-compiled executables exist for some platforms on the Github releases page.

On macOS, it can also be installed via Homebrew: brew install kubecfg

To build from source:

% PATH=$PATH:$GOPATH/bin
% go get github.com/ksonnet/kubecfg

Quickstart

# Show generated YAML
% kubecfg show -o yaml examples/guestbook.jsonnet

# Create resources
% kubecfg update examples/guestbook.jsonnet

# Modify configuration (downgrade gb-frontend image)
% sed -i.bak '\,gcr.io/google-samples/gb-frontend,s/:v4/:v3/' examples/guestbook.jsonnet
# See differences vs server
% kubecfg diff examples/guestbook.jsonnet

# Update to new config
% kubecfg update examples/guestbook.jsonnet

# Clean up after demo
% kubecfg delete examples/guestbook.jsonnet

Features

  • Supports JSON, YAML or jsonnet files (by file suffix).
  • Best-effort sorts objects before updating, so that dependencies are pushed to the server before objects that refer to them.
  • Additional jsonnet builtin functions. See lib/kubecfg.libsonnet.
  • Optional "garbage collection" of objects removed from config (see --gc-tag).

Infrastructure-as-code Philosophy

The idea is to describe as much as possible about your configuration as files in version control (eg: git).

Changes to the configuration follow a regular review, approve, merge, etc code change workflow (github pull-requests, phabricator diffs, etc). At any point, the config in version control captures the entire desired-state, so the system can be easily recreated in a QA cluster or to recover from disaster.

Jsonnet

Kubecfg relies heavily on jsonnet to describe Kubernetes resources, and is really just a thin Kubernetes-specific wrapper around jsonnet evaluation. You should read the jsonnet tutorial, and skim the functions available in the jsonnet std library.

You can’t perform that action at this time.