• Stars
    star
    295
  • Rank 140,902 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Kubernetes Lazy User Manager

klum - Kubernetes Lazy User Manager

klum does the following basic tasks:

  • Create/Delete/Modify users
  • Easily manage roles associated with users
  • Issues kubeconfig files for users to use

This is a very simple controller that just create service accounts under the hood. Properly configured this should work on any Kubernetes cluster.

Installation

kubectl apply -f https://raw.githubusercontent.com/ibuildthecloud/klum/master/deploy.yaml

Usage

Create User

kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: darren

Download Kubeconfig

kubectl get kubeconfig darren -o json | jq .spec > kubeconfig
kubectl --kubeconfig=kubeconfig get all

The name of the kubeconfig resource will be the same as the user name

Delete User

kubectl delete user darren

Assign Roles

kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: darren
spec:
  clusterRoles:
  - view
  roles:
  - namespace: default
    # you can assign cluster roles in a namespace
    clusterRole: cluster-admin
  - namespace: other
    # or assign a role specific to that namespace
    role: something-custom

If you don't assign a role a default role will be assigned to the user which is configured on the controller. The default value is cluster-admin, so change that if you want a more secure setup.

Disable user

kind: User
apiVersion: klum.cattle.io/v1alpha1
metadata:
  name: darren
spec:
  enabled: false

When the user is reenabled a new kubeconfig with new token will be created.

Configuration

The controller can be configured as follows. You will need to edit the deployment and change then environment variables:

GLOBAL OPTIONS:
   --namespace value             Namespace to create secrets and SAs in (default: "klum") [$NAMESPACE]
   --context-name value          Context name to put in Kubeconfigs (default: "default") [$CONTEXT_NAME]
   --server value                The external server field to put in the Kubeconfigs (default: "https://localhost:6443") [$SERVER_NAME]
   --ca value                    The value of the CA data to put in the Kubeconfig [$CA]
   --default-cluster-role value  Default cluster-role to assign to users with no roles (default: "cluster-admin") [$DEFAULT_CLUSTER_ROLE]

Building

make or just go build

Running

./bin/klum --kubeconfig=${HOME}/.kube/config

License

Copyright (c) 2020 Rancher Labs, Inc.

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.

More Repositories

1

systemd-docker

Wrapper for "docker run" to handle systemd quirks
Go
716
star
2

k3v

Virtual Kubernetes
Go
684
star
3

only-docker

Docker as PID 1... what?!
Shell
161
star
4

finalizers

Stupid Finalizers
Go
108
star
5

coreos-on-do

Script to install CoreOS on Digital Ocean
Shell
97
star
6

wtfk8s

Watch and print changes in k8s
Go
82
star
7

gitbacked-controller

Write controller-runtime based k8s controllers that read/write to git, not k8s
Go
50
star
8

kvsql

Storage backend for Kubernetes using Go database/sql
Go
35
star
9

cowbell

Simple web hooks for rancher
Go
16
star
10

k3s-operator

Stupid simple controller to create local k3s clusters
Go
9
star
11

jenkins-acorn

An Acorn for a Jenkins server running against Kubernetes
Dockerfile
7
star
12

os2

not OS/2
Dockerfile
7
star
13

rancher-charts

Clone of Helm stable charts
Smarty
5
star
14

iwontbuyadomain

I won't buy a domain.
HTML
4
star
15

webhook-demo

Demo webhook application for Acorn
JavaScript
4
star
16

docker-ubuntu-kvm

Scripts used to create ibuildthecloud/ubuntu-kvm
Shell
4
star
17

steve-example

Go
3
star
18

wsudp

An ever so important websocket to UDP bridge to connect quakejs to a native quake3 server
Go
3
star
19

home

My ${HOME}
Shell
3
star
20

k3os

nothing to see here
Go
3
star
21

baaah

K8s Controller Framework made out of pure frustration
Go
3
star
22

my-repo

JavaScript
2
star
23

herd

Cute Fluffy Portable Apps
Go
2
star
24

wonka

Running dockerized apps like a pro
Go
2
star
25

cros

my devscripts for chromiumos
Shell
1
star
26

ibuildthecloud.github.io

HTML
1
star
27

docker-ubuntu-core

Script used for docker image ibuildthecloud/ubuntu-core
Shell
1
star
28

docker-networking-notes

Business, Business, Business, Numbers... Is this working?
1
star
29

dstack

A sandbox for Darren's opinions and code
Java
1
star
30

fleet-simulator

Shell
1
star
31

acs-launcher

Simple main class to launch Apache CloudStack in Eclipse in a fast way
Java
1
star
32

fleet-kitchensink

Deploy everything (this takes a lot of memory)
1
star