cube

command module
v0.0.0-...-1e2aa48 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 1 Imported by: 0

README

cube

kubectl configuration manipulation tool, which fetches ~/.kube/config from remote K8s cluster and merges it into local one.

Prerequisite

cube depends on ssh tunnel for communication with remote cluster. Make sure these files -- ~/.ssh/config and /etc/hosts -- are correctly set.

~/.ssh/config
# add SSH dynamic port forwarding, where `SSH_VIA` is in the format of "<user>@<public-ip>"
# alias aws_proxy='ssh -qTfnN -D 127.0.0.1:62222 ${SSH_VIA}'

# Rules for Remote
Host [remote/private/ip/range(e.g. 172.31.*)]
 ProxyCommand /usr/bin/nc -X 4 -x 127.0.0.1:62222 %h %p
 StrictHostKeyChecking no
 UserKnownHostsFile=/dev/null
 user core
 IdentityFile [/path/to/pem/file]
 LogLevel ERROR

/etc/hosts
# add following line to /etc/hosts
# to access AWS k8s cluster by SSH tunnel
sudo echo "127.0.0.1	kubernetes" >> /etc/hosts

Install

go get -u github.com/shohi/cube

Usage

help
$> cube --help
kubectl config manipulation tool

Usage:
  cube [command]

Available Commands:
  add         add remote cluster to kube config
  delete      delete kubectl config for specified cluster
  forward     run local ssh port forwarding for remote cluster
  help        Help about any command
  history     show cube commands history
  list        list all clusters
  show        show local kubectl config
  version     print version info

Flags:
  -h, --help   help for cube

Use "cube [command] --help" for more information about a command.

use kubectx to switch cluster

$> kubectx

### Docker


docker run --rm -it \
    -v $PWD/.ssh:/root/.ssh \
    -v $PWD/.kube:/root/.kube \
    cube:0.4.1

Note

  1. cube leverages SSH and SCP for transfering files from remote cluster. Make sure SSH correctly configured.

  2. Only AWS cluster is supported now.

FAQ

  1. channel 2: open failed: connect failed: Connection refused

make sure the target service is up and running

Documentation

Overview

Copyright © 2019 Shohi Wang <oshohi@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
cmd
add
del
pkg
log
scp

Jump to

Keyboard shortcuts

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