⎈ k8s-toolbox
The ultimate Kubernetes client toolbox, embedded inside a customized container.
What's embedded in that toolbox?
This toolbox offers a convenient set of popular Kubernetes client tools. Its goal is to ease sysadmin, devops and developers life.
- cfssl: PKI and TLS toolkit https://cfssl.org/
- clouder: One-liner to create Google Cloud GKE or GCE cluster
- gnu-parallel: GNU parallel is a shell tool for executing jobs in parallel using one or more computers
- go-lang: The go programming langage tools
- gcloud: Google Cloud command-line tool
- helm, and autocompletion: Helm is the package manager for Kubernetes
- kubectl and autocompletion: kubectl controls the Kubernetes cluster manager.
- kubectl aliases: Programmatically generated handy kubectl aliases. https://ahmet.im/blog/kubectl-aliases/
- kubeval: Validation of kubernetes YAML configurations
- kustomize: Customization of kubernetes YAML configurations
- stern: Multi pod and container log tailing for Kubernetes
Installation
Pre-requisites
- Ubuntu LTS is recommended
- Internet access
sudo
access- And up and running Kubernetes cluster, and related KUBECONFIG file (see Light speed Kubernetes installation)
- Install dependencies below:
sudo apt-get install curl docker.io
# then add current user to docker group and restart desktop session
sudo usermod -a -G docker <USER>
Launch
# Create work directory
WORKDIR=$HOME/k8s
mkdir -p $WORKDIR
cd $WORKDIR
curl -lO https://raw.githubusercontent.com/k8s-school/k8s-toolbox/master/toolbox.sh
chmod +x toolbox.sh
./toolbox.sh
# If you have a valid KUBECONFIG file on your host, inside $HOME/.kube/config, command below will work fine:
kubectl get nodes
toolbox
launch open a shell inside a Docker container.
NOTE: toolbox
container home
folder mount $WORKDIR/homefs
host directory.
How-to
- On the host machine, launch an editor or IDE and add Kubernetes applications code and scripts to
homefs
directory. - Inside the
k8s-toolbox
container, directly run code and scripts.
Google Cloud setup
Pre-requisites
gmail account for regular users must have IAM roles below:
Compute OS Admin Login
Compute OS Login
Kubernetes Engine Developer
Service Account User
See https://cloud.google.com/compute/docs/instances/managing-instance-access#configure_users for additional informations.
Initialize gcloud project
# or simply run gcloud-setup.sh
cp /opt/gcp/env-gcp.example.sh $HOME/env-gcp.sh
# Customize $HOME/env-gcp.sh
. $HOME/env-gcp.sh
gcloud auth login
gcloud config set project $PROJECT
Connect to instances
# WARNING: use empty password for ssh key!
# ssh is an alias for `gcloud compute ssh`
# Replace <X> with your user ID
ssh clus<X>-0
# Set the zone if needed
gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
clus0-0 asia-east1-c n1-standard-2 10.140.0.59 35.221.224.110 RUNNING
clus0-1 asia-east1-c n1-standard-2 10.140.0.57 35.221.200.235 RUNNING
clus0-2 asia-east1-c n1-standard-2 10.140.0.58 35.185.155.134 RUNNING
gcloud config set compute/zone <ZONE>
Follow Kubernetes install documentation
Official Kubernetes installation documentation with kubeadm Simple Kubernetes installation procedure with kubeadm