Completed kubemacs via docker documentation.

This commit is contained in:
2020-05-28 16:45:46 +12:00
parent 86723a7f89
commit 0c36d20852
5 changed files with 85 additions and 0 deletions

View File

@ -50,6 +50,9 @@ export DISPLAY=:0.0
# Configure docker host
export DOCKER_HOST=tcp://localhost:2375
# Configure kubeconfig default
export KUBECONFIG=$KUBECONFIG:/c/Users/$USER/.kube/config
# Setup prompt
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"

37
kubemacs/kubemacs.env Normal file
View File

@ -0,0 +1,37 @@
# Pin your image
# KUBEMACS_IMAGE=kubemacs/kubemacs:2020.04.02
# Or not
# KUBEMACS_IMAGE=kubemacs/kubemacs:latest
KUBEMACS_IMAGE=kubemacs/kubemacs:2020.04.02
# $(id -u) / mainly for ~/.kube/config permissions
HOST_UID="1000"
# Vars for git commits
KUBEMACS_GIT_EMAIL="mail@jamesblair.net"
KUBEMACS_GIT_NAME="James Blair"
KUBEMACS_TIMEZONE=Pacific/Auckland
# This is the kind cluster name, maybe we should rename
# for some reason we can't used kind as the name
KUBEMACS_KIND_NAME=cncf.conformance
# ~/.kube/$KUBEMACS_HOSTCONFIG_NAME
KUBEMACS_HOST_KUBECONFIG_NAME=config
# Using a docker registry alongside kind
KIND_LOCAL_REGISTRY_ENABLE=true
KIND_LOCAL_REGISTRY_NAME=local-registry
KIND_LOCAL_REGISTRY_PORT=5000
# The repositories to check out
KUBEMACS_INIT_DEFAULT_REPOS='https://github.com/cncf/apisnoop.git'
# The folder to start tmate/emacs in
KUBEMACS_INIT_DEFAULT_REPOS_FOLDER="/home/projects"
# The first file you want emacs to open
KUBEMACS_INIT_ORG_FILE="apisnoop/README.org"
# If you want to see lots of information, set this to true
KUBEMACS_INIT_DEBUG=false

15
kubemacs/kubemacs.sh Executable file
View File

@ -0,0 +1,15 @@
# kubemacs.sh
ENV_FILE=kubemacs.env
. $ENV_FILE
docker run \
--env-file $ENV_FILE \
--name kubemacs-docker-init \
--user root \
--privileged \
--network host \
--rm \
-it \
-v "/c/Users/$USER/.kube:/tmp/.kube" \
-v /var/run/docker.sock:/var/run/docker.sock \
$KUBEMACS_IMAGE \
docker-init.sh

View File

@ -365,6 +365,36 @@ An integral part of our pair development workflow is [[https://github.com/kubema
*** Option 2 - Install via docker
For this method we need to set some variables in the included ~kubemacs.env~ file, then run the included ~kubemacs.sh~ script.
#+NAME: Update environment file
#+begin_src shell
sed -i 's/KUBEMACS_GIT_EMAIL.*/KUBEMACS_GIT_EMAIL="mail@jamesblair.net"/g' kubemacs/kubemacs.env
sed -i 's/KUBEMACS_GIT_NAME.*/KUBEMACS_GIT_NAME="James Blair"/g' kubemacs/kubemacs.env
#+end_src
Next we create a folder ~.kube~ folder in windows that can be mounted through into docker for windows. Currently we cannot mount wsl folders into docker for windows.
#+NAME: Setup kubeconfig mount
#+begin_src shell
# Make the windows folder for out kubeconfig
mkdir -p /c/Users/$USER/.kube
# Set that folder to the volume mount
sed -i 's|^.*[.]kube| -v "/c/Users/$USER/.kube:/tmp/.kube|g' kubemacs/kubemacs.sh
# Export that folder for kubeconfig
export KUBECONFIG=$KUBECONFIG:/c/Users/$USER/.kube/config
#+end_src
After updating the environment file and preparing the kubeconfig mount we are ready to launch kubemacs in a kind cluster by running the script :)
Do this in your left eye terminal as this will pop you straight into kubemacs.
#+NAME: Launch kubemacs left eye
#+begin_src shell
./kubemacs/kubemacs.sh
#+end_src
** Step 5 - Setup mutt email client