conf2kube

command module
v0.0.0-...-1522587 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

conf2kube

conf2kube creates Kubernetes secrets based on contents of configuration files.

This is not an official Google product.

Install

Download a binary release or use the go get command.

$ go get github.com/kelseyhightower/conf2kube

Usage

$ conf2kube -h
Usage of conf2kube:
  -f file
        Path to configuration file. Defaults to stdin. (default "-")
  -n name
        The name to use for the Kubernetes secret. Defaults to basename of configuration file.
  -k key
        The key to use for the Kubernetes secret in the data section of the secret. 
        Defaults to the name (stdin) or basename of configuration file.
  -x    Extract config from incoming JSON formatted secret and print to stdout.
Create a new secret from stdin
$ cat redis.conf | conf2kube -n redis.conf -f - | kubectl create -f -

The -f flag is optional when creating secrets from stdin.

Create a new secret from a configuration file
$ conf2kube -f redis.conf | kubectl create -f -

Use the -n flag to create a secret with a specific name.

$ conf2kube -f redis.conf -n redis-master.conf | kubectl create -f -
Update an existing secret

Use the kubectl apply command to update an existing secret.

$ conf2kube -f redis.conf | kubectl apply -f -
Extract the contents of a secret

Use the -x flag to extract JSON formated secrets from stdin.

$ kubectl get secrets redis.conf -o json | conf2kube -x

Use the -n flag to extract a secret by a specific data name. Useful when the data name does not match the secret name.

$ kubectl get secrets redis.conf -o json | conf2kube -x -n redis-master.conf
Create a new secret from a configuration file with multiple entries
$ conf2kube -n nginx-ssl-certs -f example.com.crt | kubectl create -f -

Add additional entries to the same secret using kubectl patch.

$ kubectl patch secret nginx-ssl-certs -p `conf2kube -n nginx-ssl-certs -f example.com.csr`
$ kubectl patch secret nginx-ssl-certs -p `conf2kube -n nginx-ssl-certs -f example.com.key`

A secret named nginx-ssl-certs is created with 3 entries: example.com.crt, example.com.csr and example.com.key.

Extract the contents of a multi-value secret

Use the -x flag to extract JSON formated secrets from stdin, and the -k flag to specify which secret.

$ kubectl get secret nginx-ssl-certs -o json | conf2kube -x -k example.com.csr

Documentation

Overview

Copyright 2015 Google, Inc All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL