krisnova / krex

Kubernetes Resource Explorer
Apache License 2.0
134 stars 19 forks source link

Linux instructions via Dockerfile #39

Open DazWilkin opened 6 years ago

DazWilkin commented 6 years ago

Learned of Krex when @kris-nova demonstrated it during TGI Kubernetes #41.

It's neat. Thank you for creating it.

The following should (!?) get you containerized Krex:

Dockerfile.stretch:

FROM golang:1.10.3-stretch

LABEL maintainer="Your Name<your@email.com>"

RUN apt update && \
    apt install -y \
        libncurses5-dev \
        libncursesw5-dev

RUN go get github.com/kris-nova/krex

ENTRYPOINT ["/go/bin/krex"]

Dockerfile.alpine: NB This image is problematic in rendering the curses-based UI accurately. It works but the painting is inconsistent.

FROM golang:1.10.3-alpine3.8

LABEL maintainer="Your Name<your@email.com>"

RUN apk update && \
    apk add --no-cache \
        build-base \
        git \
        ncurses-libs \
        ncurses-dev

RUN go get github.com/kris-nova/krex

ENTRYPOINT ["/go/bin/krex"]

Dockerfile.debian -- to see how to burst this to a local Linux install:

FROM debian:jessie

LABEL maintainer="Your Name<your@email.com>"

RUN apt update && \
    apt install -y \
        git \
        gcc \
        libncurses5-dev \
        libncursesw5-dev \
        make \
        pkg-config \
        wget

# Install Golang

# Defaults for the Golang installation
ARG VERSION=1.10.3
ARG OS=linux
ARG ARCH=amd64

# Construct the filename, download it, install then tidy up
RUN FILE="go${VERSION}.${OS}-${ARCH}.tar.gz" && \
    wget \
      --quiet \
      --relative \
      --output-document=$PWD/${FILE} \
      https://dl.google.com/go/${FILE} && \
    tar \
      --directory /usr/local \
      --extract \
      --gunzip \
      --file ${FILE} && \
    rm ${FILE}

# Update the path for Golang
ENV PATH=${PATH}:/usr/local/go/bin

# Create a workspace for Krex, then get (incl. build) it
RUN mkdir ${PWD}/go

ENV GOPATH=${PWD}/go
ENV PATH=${PATH}:${GOPATH}/bin

RUN go get github.com/kris-nova/krex

ENTRYPOINT ["/go/bin/krex"]

When you run the container, you can bind it to the local ${HOME}/.kube/config with:

docker run \
--interactive \
--tty \
--volume=${HOME}/.kube/config:/root/.kube/config krex

If, like me, you're using Kubernetes Engine which depends upon a gcloud helper to generate credentials tokens for the cluster, you (a) must add python to the installs; and (b) can bind gcloud and ${HOME}/.config/gcloud with:

docker run \
--interactive \
--tty \
--volume=${HOME}/.kube/config:/root/.kube/config \
--volume=${HOME}/.config/gcloud:/root/.config/gcloud \
--volume=/usr/lib/google-cloud-sdk:/usr/lib/google-cloud-sdk \
krex
rugwirobaker commented 5 years ago

Great thank you