• Stars
    star
    392
  • Rank 109,735 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Directly access data objects stored in etcd by kubernetes.

Auger

Directly access data objects stored in etcd by kubernetes.

Encodes and decodes Kubernetes objects from the binary storage encoding used to store data to etcd. Supports data conversion to YAML, JSON and Protobuf.

Automatically determines if etcd data is stored in JSON (kubernetes 1.5 and earlier) or binary (kubernetes 1.6 and newer) and decodes accordingly.

Why?

In earlier versions of kubernetes, data written to etcd was stored as JSON and could easily be inspected or manipulated using standard tools such as etcdctl. In kubernetes 1.6+, for efficiency reasons, much of the data is now stored in a binary storage representation, and is non-trivial to decode-- it contains a enveloped payload that must be unpacked, type resolved and decoded.

This tool provides kubernetes developers and cluster operators with simple way to access the binary storage data via YAML and JSON.

Installation

Check out and build:

git clone https://github.com/jpbetz/auger
cd auger
make release

Run:

build/auger -h

Use cases

Access data via etcdctl

A kubernetes developer or cluster operator needs to inspect the data actually stored to etcd for a particular kubernetes object.

E.g., decode a pod from etcd v3, where <pod-name> is the name of one of your pods:

ETCDCTL_API=3 etcdctl get /registry/pods/default/<pod-name> | auger decode
> apiVersion: v1
> kind: Pod
> metadata:
>   annotations: ...
>   creationTimestamp: 2017-06-27T16:35:34Z
> ...

Modify data via etcdctl

A kubernetes developer or etcd developer needs to modify state of an object stored in etcd.

E.g. Write an updated pod to etcd v3:

cat updated-pod.yaml | auger encode | ETCDCTL_API=3 etcdctl put /registry/pods/default/<pod-name>

Access data directly from db file

A cluster operator, kubernetes developer or etcd developer is needs to inspect etcd data without starting etcd. In extreme cases, it may not be possible to start etcd and inspecting the data may help a etcd developer understand what state it is in.

E.g. find an etcd value by it's key and extract it from a boltdb file:

auger extract -f <boltdb-file> -k /registry/pods/default/<pod-name>
> apiVersion: v1
> kind: Pod
> metadata:
>   annotations: ...
>   creationTimestamp: 2017-06-27T16:35:34Z
> ...

Query for specific data directly from a db file:

auger extract -f <boltdb-file> --template="{{.Value.kind}} {{.Value.metadata.name}}" --filter=".Value.metadata.namespace=default"
> Endpoints kubernetes
> Service kubernetes
> ...

Consistency and corruption checking

First get a checksum and latest revsion from one of the members:

auger checksum -f <member-1-boltdb-file>
> checksum: 1282050701
> revision: 7

Then compare it with the other members:

auger checksum -f <member-2-boltdb-file> -r 7
> checksum: 1282050701
> revision: 7

auger checksum -f <member-3-boltdb-file> -r 7
> checksum: 8482350767
> revision: 7
# Oh noes! The checksum should have been the same!

TODO

  • Warn if attempting to read data written by a different version of kubernetes
  • Add detection of unrecognized fields in stored data, which would suggest data was written with newer version of proto schema
  • Build and publish releases for all recent kubernetes versions (1.6+)

More Repositories

1

planet-generator

3D procedural planet generator
C#
29
star
2

subspace

Lightweight vector and matrix math library for OpenGL programming in Scala.
Scala
10
star
3

KoT

Go
7
star
4

synthesis.js

A content synthesis library for for WebGL and three.js.
JavaScript
7
star
5

plant-generator

Unreal Engine application that generates random plants using L-Systems
C++
6
star
6

cli-util

cli-util is an extension of apache common's java command line interface (commons-cli) library. It adds sub commands, more type safely and a declarative style for defining commands, their options, flags and arguments.
Java
6
star
7

validation-admission-policy-examples

A directory of various validating admission policies
Shell
5
star
8

Breakbulk

Snapshot of openanzo, the opensource codebase we built up at Cambridge Semantics. It's all semantic web stuff: RDF, sparql, OWL, and a bunch of client/server stuff.
Java
4
star
9

sudoku-dlx

Sudoku solver in Scala. Maps problem to exact cover matrix and uses dancing links and algorithm X.
Scala
3
star
10

protolang

A primitive prototype language using Haskell as the frontend and LLVM as the backend.
Haskell
2
star
11

programmatic-scaladoc-example

A summary of the state of Scaladoc's API (circa 2013) and some ideas about how to cope with it if you need to use it
Scala
2
star
12

cel-webhook

Go
1
star
13

kubecon

Go
1
star
14

conversion-webhook-example

Go
1
star
15

unshredder

Python
1
star
16

shoelaces

empty shell using bootstrap + scala play + gson + script oauth + facebook
JavaScript
1
star
17

jpbetz.github.io

CSS
1
star
18

celpatch

Use CEL in YAML to create Kubernetes resource updates
Go
1
star