Categorygithub.com/lightnet328/kubernetes-ssh-container-exposer

# README

Kubernetes SSH Container Exposer

Kubernetes SSH Container Exposer registers the SSH container information in the database and helps to proxy by SSHPiper.

                                               Kubernetes
                              +------------------------------------------+
                              |                        Namespace=bob     |
                              | +----------------+ +-------------------+ |
                              | |                | |                   | |
                              | | +------------+ | | +---------------+ | |
                              | | |            | | | |               | | |
                              | | |   MySQL    | | | | SSH Container | | |
+---------+                   | | |            | | | |               | | |
|         |                   | | +------------+ | | +-------^-------+ | |
|   Bob   +--+ssh -l bob+---+ | |                | |         |         | |
|         |                 | | | +------------+ | +---------|---------+ |
+---------+                 | | | |            | |           |           |
                            +-----> SSH Piper  +-------------+           |
+---------+                 | | | |            | |           |           |
|         |                 | | | +------------+ | +---------|---------+ |
|  Alice  +--+ssh -l alice+-+ | |                | |         |         | |
|         |                   | | +------------+ | | +-------v-------+ | |
+---------+                   | | |            | | | |               | | |
                              | | |    KSCE    | | | | SSH Container | | |
                              | | |            | | | |               | | |
                              | | +------------+ | | +---------------+ | |
                              | |                | |                   | |
                              | +----------------+ +-------------------+ |
                              |                       Namespace=alice    |
                              +------------------------------------------+

Installing the Chart

To install the chart with the release name ksce:

$ git clone [email protected]:lightnet328/kubernetes-ssh-container-exposer.git
$ cd kubernetes-ssh-container-exposer
$ helm dep build
$ helm inspect values . > ksce.yaml
# Edit the values files
$ vim ksce.yaml
$ helm install --name ksce --values ksce.yaml .

Uninstalling the Chart

To uninstall/delete the ksce deployment:

$ helm delete ksce --purge

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the KSCE chart and their default values.

ParameterDescriptionDefault
image.repositoryKSCE Image namelightnet328/kubernetes-ssh-container-exposer
image.tagKSCE Image tag0.3.0
image.pullPolicyImage pull policyIfNotPresent
sshpiper.image.repositorySSHPiper Image namefarmer1992/sshpiperd
sshpiper.image.tagSSHPiper Image taglatest
sshpiper.image.pullPolicyImage pull policyIfNotPresent
sshpiper.service.typeKubernetes Service typeNodePort
sshpiper.service.portKubernetes Service port2222
mysql.mysqlRootPasswordPassword for the root user.9M0ujgwXes879BqQ

Configuration on ssh container

# Create public and private keys to communicate between ssh container and sshpiper
$ ssh-keygen -f id_rsa
$ SSHPIPER_PRIVATE_KEY=`cat id_rsa.pub | base64`
$ SSHPIPER_PUBLIC_KEY=`cat id_rsa | base64`
$ PUBLIC_KEY=`cat $HOME/.ssh/id_rsa.pub | base64`
$ echo "
apiVersion: v1
kind: Pod
metadata:
  name: ssh-pod
  labels:
    app: ssh-pod
spec:
  containers:
    - name: ssh-pod
      image: ssh-pod:latest
      ports:
        - containerPort: 22
      volumeMounts:
        - mountPath: /root/.ssh/
          name: authorized-keys
  volumes:
  - name: authorized-keys
    secret:
      secretName: ssh-pod-sshpiper-publickey
---
apiVersion: v1
kind: Secret
metadata:
  name: ssh-pod-sshpiper-publickey
type: Opaque
data:
  authorized_keys: $SSHPIPER_PUBLIC_KEY
---
apiVersion: v1
kind: Secret
metadata:
  name: ssh-pod
type: Opaque
data:
  sshpiper_id_rsa: $SSHPIPER_PRIVATE_KEY
  downstream_id_rsa.pub: $PUBLIC_KEY
" > ssh-pod.yml
$ kubectl create -f ssh-pod.yml

# Functions

No description provided by the author

# Constants

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author