Compare commits
1 commit
9408691f86
...
e8a85434ca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a85434ca |
5 changed files with 14 additions and 63 deletions
35
Dockerfile
35
Dockerfile
|
|
@ -23,23 +23,16 @@ RUN apt-get update \
|
||||||
FROM debian:trixie-slim
|
FROM debian:trixie-slim
|
||||||
|
|
||||||
# renovate: datasource=github-releases depName=janosmiko/lfk
|
# renovate: datasource=github-releases depName=janosmiko/lfk
|
||||||
ARG LFK_VERSION=0.14.18
|
ARG LFK_VERSION=0.14.15
|
||||||
# renovate: datasource=github-releases depName=kubernetes/kubernetes
|
# renovate: datasource=github-releases depName=kubernetes/kubernetes
|
||||||
ARG KUBECTL_VERSION=1.36.2
|
ARG KUBECTL_VERSION=1.36.2
|
||||||
# renovate: datasource=github-releases depName=helm/helm
|
# renovate: datasource=github-releases depName=helm/helm
|
||||||
ARG HELM_VERSION=3.21.2
|
ARG HELM_VERSION=3.21.2
|
||||||
# renovate: datasource=github-releases depName=derailed/k9s
|
# renovate: datasource=github-releases depName=derailed/k9s
|
||||||
ARG K9S_VERSION=0.51.0
|
ARG K9S_VERSION=0.51.0
|
||||||
# renovate: datasource=github-releases depName=int128/kubelogin
|
|
||||||
ARG OIDC_LOGIN_VERSION=1.36.2
|
|
||||||
# renovate: datasource=github-tags depName=ahmetb/kubectx
|
|
||||||
ARG KUBECTX_VERSION=0.9.5
|
|
||||||
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
LANG=en_US.UTF-8 \
|
|
||||||
LANGUAGE=en_US:en \
|
|
||||||
LC_ALL=en_US.UTF-8 \
|
|
||||||
WEB_SSH_PORT=3000 \
|
WEB_SSH_PORT=3000 \
|
||||||
WEBSSH2_LISTEN_PORT=3001 \
|
WEBSSH2_LISTEN_PORT=3001 \
|
||||||
WEBSSH2_SSH_HOST=127.0.0.1 \
|
WEBSSH2_SSH_HOST=127.0.0.1 \
|
||||||
|
|
@ -56,12 +49,7 @@ RUN apt-get update \
|
||||||
bash-completion \
|
bash-completion \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
jq \
|
|
||||||
locales \
|
|
||||||
unzip \
|
|
||||||
tar \
|
tar \
|
||||||
vim \
|
|
||||||
yq \
|
|
||||||
nginx-light \
|
nginx-light \
|
||||||
netcat-openbsd \
|
netcat-openbsd \
|
||||||
openssh-client \
|
openssh-client \
|
||||||
|
|
@ -93,23 +81,10 @@ RUN apt-get update \
|
||||||
&& curl -fsSLo "/tmp/k9s_Linux_amd64.tar.gz" "https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_amd64.tar.gz" \
|
&& curl -fsSLo "/tmp/k9s_Linux_amd64.tar.gz" "https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_amd64.tar.gz" \
|
||||||
&& tar -xzf "/tmp/k9s_Linux_amd64.tar.gz" -C /tmp \
|
&& tar -xzf "/tmp/k9s_Linux_amd64.tar.gz" -C /tmp \
|
||||||
&& install -m 0755 /tmp/k9s /usr/local/bin/k9s \
|
&& install -m 0755 /tmp/k9s /usr/local/bin/k9s \
|
||||||
&& curl -fsSLo "/tmp/kubelogin_linux_amd64.zip" "https://github.com/int128/kubelogin/releases/download/v${OIDC_LOGIN_VERSION}/kubelogin_linux_amd64.zip" \
|
|
||||||
&& curl -fsSLo "/tmp/kubelogin_linux_amd64.zip.sha256" "https://github.com/int128/kubelogin/releases/download/v${OIDC_LOGIN_VERSION}/kubelogin_linux_amd64.zip.sha256" \
|
|
||||||
&& sed 's#\*kubelogin_linux_amd64.zip$#*/tmp/kubelogin_linux_amd64.zip#' /tmp/kubelogin_linux_amd64.zip.sha256 | sha256sum -c - \
|
|
||||||
&& unzip -p /tmp/kubelogin_linux_amd64.zip kubelogin > /usr/local/bin/kubectl-oidc_login \
|
|
||||||
&& chmod 0755 /usr/local/bin/kubectl-oidc_login \
|
|
||||||
&& curl -fsSLo /usr/local/bin/kubectx "https://raw.githubusercontent.com/ahmetb/kubectx/v${KUBECTX_VERSION}/kubectx" \
|
|
||||||
&& curl -fsSLo /usr/local/bin/kubens "https://raw.githubusercontent.com/ahmetb/kubectx/v${KUBECTX_VERSION}/kubens" \
|
|
||||||
&& chmod 0755 /usr/local/bin/kubectx /usr/local/bin/kubens \
|
|
||||||
&& mkdir -p /etc/bash_completion.d \
|
&& mkdir -p /etc/bash_completion.d \
|
||||||
&& curl -fsSLo /etc/bash_completion.d/kubectx "https://raw.githubusercontent.com/ahmetb/kubectx/v${KUBECTX_VERSION}/completion/kubectx.bash" \
|
|
||||||
&& curl -fsSLo /etc/bash_completion.d/kubens "https://raw.githubusercontent.com/ahmetb/kubectx/v${KUBECTX_VERSION}/completion/kubens.bash" \
|
|
||||||
&& kubectl completion bash > /etc/bash_completion.d/kubectl \
|
&& kubectl completion bash > /etc/bash_completion.d/kubectl \
|
||||||
&& helm completion bash > /etc/bash_completion.d/helm \
|
&& helm completion bash > /etc/bash_completion.d/helm \
|
||||||
&& chmod 0644 /etc/bash_completion.d/kubectl /etc/bash_completion.d/helm /etc/bash_completion.d/kubectx /etc/bash_completion.d/kubens \
|
&& chmod 0644 /etc/bash_completion.d/kubectl /etc/bash_completion.d/helm \
|
||||||
&& sed -i 's/^# *en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
|
||||||
&& locale-gen en_US.UTF-8 \
|
|
||||||
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
|
|
||||||
&& rm -f /tmp/kubectl.sha256 \
|
&& rm -f /tmp/kubectl.sha256 \
|
||||||
&& rm -rf /tmp/linux-amd64 \
|
&& rm -rf /tmp/linux-amd64 \
|
||||||
&& rm -f \
|
&& rm -f \
|
||||||
|
|
@ -118,12 +93,8 @@ RUN apt-get update \
|
||||||
/tmp/k9s \
|
/tmp/k9s \
|
||||||
/tmp/README.md \
|
/tmp/README.md \
|
||||||
/tmp/LICENSE \
|
/tmp/LICENSE \
|
||||||
/tmp/kubelogin_linux_amd64.zip \
|
|
||||||
/tmp/kubelogin_linux_amd64.zip.sha256 \
|
|
||||||
/tmp/k9s_Linux_amd64.tar.gz \
|
/tmp/k9s_Linux_amd64.tar.gz \
|
||||||
&& rm -f /etc/ssh/ssh_host_* \
|
&& rm -f /etc/ssh/ssh_host_*
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
|
|
||||||
COPY docker/sshd/10-lfk-base.conf /etc/ssh/sshd_config.d/10-lfk-base.conf
|
COPY docker/sshd/10-lfk-base.conf /etc/ssh/sshd_config.d/10-lfk-base.conf
|
||||||
COPY docker/nginx/webssh.conf /etc/nginx/conf.d/webssh.conf
|
COPY docker/nginx/webssh.conf /etc/nginx/conf.d/webssh.conf
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
- `kubectl` preinstalled from a pinned upstream binary release
|
- `kubectl` preinstalled from a pinned upstream binary release
|
||||||
- `helm` preinstalled from a pinned upstream binary release
|
- `helm` preinstalled from a pinned upstream binary release
|
||||||
- `k9s` preinstalled from a pinned GitHub release tarball
|
- `k9s` preinstalled from a pinned GitHub release tarball
|
||||||
- `kubectx` and `kubens` preinstalled from a pinned upstream release
|
- `kubectl` and `helm` bash autocompletion enabled for both `admin` and `user`
|
||||||
- `jq`, `yq`, and `vim` preinstalled from Debian packages
|
|
||||||
- `kubectl`, `helm`, `kubectx`, and `kubens` bash autocompletion enabled for both `admin` and `user`
|
|
||||||
- local `openssh-server` on port `2222`
|
- local `openssh-server` on port `2222`
|
||||||
- a browser-based SSH client on port `3000`
|
- a browser-based SSH client on port `3000`
|
||||||
- a custom ASCII-art MOTD on login
|
- a custom ASCII-art MOTD on login
|
||||||
|
|
@ -73,8 +71,6 @@ The included [docker-compose.yaml](docker-compose.yaml) enables kubeconfig boots
|
||||||
|
|
||||||
That bootstrap is explicitly opt-in and defaults to off in the container itself, so it does not run in Kubernetes unless you deliberately enable it.
|
That bootstrap is explicitly opt-in and defaults to off in the container itself, so it does not run in Kubernetes unless you deliberately enable it.
|
||||||
|
|
||||||
When both are available, the bootstrap kubeconfig is applied after the service-account kubeconfig and therefore takes precedence.
|
|
||||||
|
|
||||||
Start it with:
|
Start it with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
16
docker/motd
16
docker/motd
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
╔════════════════════════════════════════════════════════════════╗
|
╔════════════════════════════════════════════════════════════════╗
|
||||||
║ ║
|
║ ║
|
||||||
║ ║
|
║ ██╗ ███████╗██╗ ██╗ ██╗ ██╗ █████╗ ███████╗ ║
|
||||||
║ _ __ ___ ____ __ __ ____ __ __ _____ ║
|
║ ██║ ██╔════╝██║ ██╔╝ ██║ ██╔╝██╔══██╗██╔════╝ ║
|
||||||
║ | |/ / / _ \ / ___| | \/ | / ___|| \/ ||_ _| ║
|
║ ██║ █████╗ █████╔╝ █████╔╝ ╚█████╔╝███████╗ ║
|
||||||
║ | ' / | (_) |\___ \ | |\/| || | _ | |\/| | | | ║
|
║ ██║ ██╔══╝ ██╔═██╗ ██╔═██╗ ██╔══██╗╚════██║ ║
|
||||||
║ | . \ \__, | ___) | | | | || |_| || | | | | | ║
|
║ ███████╗██║ ██║ ██╗ ██║ ██╗╚█████╔╝███████║ ║
|
||||||
║ |_|\_\ /_/ |____/ |_| |_| \____||_| |_| |_| ║
|
║ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝ ╚══════╝ ║
|
||||||
║ Kubernetes Management Pod - Jump Box ║
|
║ Kubernetes Management Pod - Jump Box ║
|
||||||
║ ║
|
║ ║
|
||||||
╠════════════════════════════════════════════════════════════════╣
|
╠════════════════════════════════════════════════════════════════╣
|
||||||
║ Toolbelt ║
|
║ Toolbelt ║
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
║ - lfk : LFK kubernetes management ║
|
║ - lfk : LFK kubernetes management ║
|
||||||
║ - k9s : interactive cluster navigation ║
|
║ - k9s : interactive cluster navigation ║
|
||||||
║ - helm : chart install, upgrade, and rollback ║
|
║ - helm : chart install, upgrade, and rollback ║
|
||||||
║ - plus : kubectx, kubens, jq, yq, vim, and more ║
|
║ - plus : kubectx, kubens, jq, yq, and more ║
|
||||||
║ ║
|
║ ║
|
||||||
╠════════════════════════════════════════════════════════════════╣
|
╠════════════════════════════════════════════════════════════════╣
|
||||||
║ Quick start ║
|
║ Quick start ║
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,6 @@ if [ -n "${BASH_VERSION:-}" ]; then
|
||||||
if [ -r /etc/bash_completion.d/helm ]; then
|
if [ -r /etc/bash_completion.d/helm ]; then
|
||||||
. /etc/bash_completion.d/helm
|
. /etc/bash_completion.d/helm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r /etc/bash_completion.d/kubectx ]; then
|
|
||||||
. /etc/bash_completion.d/kubectx
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -r /etc/bash_completion.d/kubens ]; then
|
|
||||||
. /etc/bash_completion.d/kubens
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias k=kubectl
|
alias k=kubectl
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,6 @@ install_kubeconfig_for_user() {
|
||||||
local kube_config="${kube_dir}/config"
|
local kube_config="${kube_dir}/config"
|
||||||
|
|
||||||
mkdir -p "${kube_dir}"
|
mkdir -p "${kube_dir}"
|
||||||
mkdir -p "${kube_dir}/cache"
|
|
||||||
chown -R "${username}:${username}" "${kube_dir}"
|
|
||||||
chmod 0700 "${kube_dir}"
|
|
||||||
install -m 0600 -o "${username}" -g "${username}" "${source_kubeconfig}" "${kube_config}"
|
install -m 0600 -o "${username}" -g "${username}" "${source_kubeconfig}" "${kube_config}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -294,13 +291,8 @@ EOF
|
||||||
prepare_runtime() {
|
prepare_runtime() {
|
||||||
mkdir -p /var/run/sshd
|
mkdir -p /var/run/sshd
|
||||||
ensure_host_keys
|
ensure_host_keys
|
||||||
if [[ "${ENABLE_BOOTSTRAP_KUBECONFIG}" == "true" ]]; then
|
install_serviceaccount_kubeconfig
|
||||||
log "Kubeconfig mode: bootstrap-only (serviceaccount kubeconfig generation disabled)."
|
install_bootstrap_kubeconfig
|
||||||
install_bootstrap_kubeconfig
|
|
||||||
else
|
|
||||||
log "Kubeconfig mode: in-cluster serviceaccount."
|
|
||||||
install_serviceaccount_kubeconfig
|
|
||||||
fi
|
|
||||||
persist_kubernetes_login_env
|
persist_kubernetes_login_env
|
||||||
configure_user_auth admin ADMIN_SSH_PUBKEY ADMIN_PASSWORD
|
configure_user_auth admin ADMIN_SSH_PUBKEY ADMIN_PASSWORD
|
||||||
configure_user_auth user USER_SSH_PUBKEY USER_PASSWORD
|
configure_user_auth user USER_SSH_PUBKEY USER_PASSWORD
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue