You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ii brings a number of technologies together to create an open workflow.
Using docker will reduce the setup and maintenance of sharing the core components with others.
PODNAME=$(kubectl -n kubemacs get pod --selector=app=kubemacs -o name | sed s:pod/::)
kubectl exec -n kubemacs -t -i $PODNAME -- attach
dev-build loop
IIDE=gcr.io/apisnoop/kubemacs:0.9.23
PODNAME=$(kubectl -n kubemacs get pod --selector=app=kubemacs -o name | sed s:pod/::)
docker build -t $IIDE.
kind load docker-image $IIDE
kubectl run --generator=run-pod/v1 $PODNAME --serviceaccount='admin-kubemacs' --image=$IIDE
kubectl exec -t -i $PODNAME -- attach # osc52 will be sent with tmate url / you can have multiple of these
Script to connect to a remote box and configure your kubeconfig
# configurationexport KUBECONFIG=~/.kube/config-my-remote
# [IMPORTANT] set your user
REMOTE_USER=root
# [IMPORTANT] set your remote box's IP
REMOTE_HOST=x.x.x.x
# fetch the remote kubeconfig
ssh $REMOTE_USER@$REMOTE_HOST kubectl config view --merge --minify --flatten >$KUBECONFIG# find the port of the Kubernetes API in the kubeconfig and export itexport K8S_REMOTE_PORT=$(kubectl config view -o jsonpath='{.clusters[0].cluster.server}'| cut -d ':' -f3)# forward the port from the remote box to the localhost
ssh -fN -L $K8S_REMOTE_PORT:localhost:$K8S_REMOTE_PORT$REMOTE_USER@$REMOTE_HOST
kubectl get pods -A
Add a helper function to your ~/.bashrc
Name
Purpose
Example
KUBECONFIG
the kubeconfig to save to and use
~/.kube/config-my-remote
REMOTE_USER
the remote user to login as
ii
REMOTE_HOST
the remote host/ip to connect to
myhost.example.com
cat <<EOF >> ~/.bashrcfunction ii_setup_k8s_from_remote() {# ensure:# - remote server kubeconfig# - defined $KUBECONFIG# - remote server Kubernetes API forwarded to localhostfunction ii_setup_k8s_from_remote_cleanup() { set +e}trap ii_setup_k8s_from_remote_cleanup EXITset -eif [ -x /tmp/ii_setup_k8s_from_remote-hasrun ]; then returnfi# configurationif [ -z \$KUBECONFIG ]; then export KUBECONFIG=~/.kube/config-my-remotefi# [IMPORTANT] set your userif [ -z \$REMOTE_USER ]; then echo "[error] please set \\\$REMOTE_USER" returnfi# [IMPORTANT] set your remote box's IPif [ -z \$REMOTE_HOST ]; then echo "[error] please set \\\$REMOTE_HOST" returnfi# fetch the remote kubeconfigssh \$REMOTE_USER@\$REMOTE_HOST kubectl config view --merge --minify --flatten > \$KUBECONFIG# find the port of the Kubernetes API in the kubeconfig and export itexport K8S_REMOTE_PORT=\$(kubectl config view -o jsonpath='{.clusters[0].cluster.server}' | cut -d ':' -f3)# check if not already listeningif ! lsof -i:\$K8S_REMOTE_PORT 2>&1 > /dev/null; then # forward the port from the remote box to the localhost ssh -fN -L \$K8S_REMOTE_PORT:localhost:\$K8S_REMOTE_PORT \$REMOTE_USER@\$REMOTE_HOSTfiexport DOCKER_HOST="ssh://\\\$REMOTE_USER@\\\$REMOTE_HOST"echo "[ok]"touch /tmp/ii_setup_k8s_from_remote-hasrunii_setup_k8s_from_remote_cleanup}EOF