Skip to content

Instantly share code, notes, and snippets.

@jjo
Last active December 20, 2020 10:09
Show Gist options
  • Select an option

  • Save jjo/78f60702fbfa1cbec7dd865f67a3728a to your computer and use it in GitHub Desktop.

Select an option

Save jjo/78f60702fbfa1cbec7dd865f67a3728a to your computer and use it in GitHub Desktop.

Revisions

  1. jjo revised this gist Nov 27, 2017. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -23,16 +23,18 @@ kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # helm
    curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v2.7.1-linux-amd64.tar.gz
    tar -xvf helm-v2.6.1-linux-amd64.tar.gz
    HELM_VERSION=2.7.2
    curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz
    tar -xvf helm-v${HELM_VERSION}-linux-amd64.tar.gz
    mv linux-amd64/helm /usr/local/bin/
    helm init
    helm repo update

    # dev tools and latest GO
    GO_VERSION=1.9.2
    yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
    curl -LO https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz
    tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go* /usr/local/bin/


    @@ -48,4 +50,6 @@ kubeadm join --token $(kubeadm token list |sed -n 2p|egrep -o '^\S+') $(sed -rn
    # tmate ftW
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    # ssh keys needed by tmate to start:
    ssh-keygen -t rsa -b 4096 -P "" -f "$HOME/.ssh/id_rsa"
    (script -qfc tmate |egrep -o "ssh \S+tmate.io") &
  2. jjo revised this gist Nov 27, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -48,4 +48,4 @@ kubeadm join --token $(kubeadm token list |sed -n 2p|egrep -o '^\S+') $(sed -rn
    # tmate ftW
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    script -qfc tmate |egrep -o "ssh \S+tmate.io"
    (script -qfc tmate |egrep -o "ssh \S+tmate.io") &
  3. jjo revised this gist Nov 27, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -23,16 +23,16 @@ kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # helm
    curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v2.6.1-linux-amd64.tar.gz
    curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v2.7.1-linux-amd64.tar.gz
    tar -xvf helm-v2.6.1-linux-amd64.tar.gz
    mv linux-amd64/helm /usr/local/bin/
    helm init
    helm repo update

    # dev tools and latest GO
    yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.8.linux-amd64.tar.gz
    curl -LO https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go* /usr/local/bin/


  4. jjo revised this gist Oct 13, 2017. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -22,12 +22,20 @@ yum -q -y install bash-completion git-core tmux vim wget sudo which > /dev/null
    kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # helm
    curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v2.6.1-linux-amd64.tar.gz
    tar -xvf helm-v2.6.1-linux-amd64.tar.gz
    mv linux-amd64/helm /usr/local/bin/
    helm init
    helm repo update

    # dev tools and latest GO
    yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.8.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go* /usr/local/bin/


    # jjo'isms
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config/
    git clone http://github.com/jjo/bin
  5. jjo revised this gist Oct 2, 2017. No changes.
  6. jjo revised this gist Sep 29, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -40,4 +40,4 @@ kubeadm join --token $(kubeadm token list |sed -n 2p|egrep -o '^\S+') $(sed -rn
    # tmate ftW
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    script -qfc tmate |egrep -o ssh.session:.*
    script -qfc tmate |egrep -o "ssh \S+tmate.io"
  7. jjo revised this gist Sep 28, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    # bash -x <( curl -L bit.do/jjo-pwk-sh )
    #
    # https://gist.github.com/jjo/78f60702fbfa1cbec7dd865f67a3728a/edit
    # http://bit.do/admin/edit/jjo-pwk-sh
    #

    # Initialize cluster and FIXUP some play-with-k8s annoyances
  8. jjo revised this gist Sep 28, 2017. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,11 @@
    #
    # bash -x <( curl -L bit.do/jjo-pwk-sh )
    #
    # https://gist.github.com/jjo/78f60702fbfa1cbec7dd865f67a3728a/edit
    #

    # Initialize cluster and FIXUP some play-with-k8s annoyances
    test -f ~/kubeadm-init.log || (
    test -d /etc/kubernetes/pki || (
    kubeadm init --apiserver-advertise-address $(hostname -i) | tee ~/kubeadm-init.log
    kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 -w0)"
    curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | kubectl apply -f -
    @@ -21,9 +23,9 @@ source /etc/bash_completion.d/kubectl.completion

    # dev tools and latest GO
    yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
    curl -LO https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.8.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go /usr/local/bin/go
    ln -sf /usr/local/go/bin/go* /usr/local/bin/

    # jjo'isms
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config/
    @@ -32,6 +34,7 @@ git clone http://github.com/jjo/bin
    # show kubeadm join ...
    echo "* Join nodes with:"
    grep -o "kubeadm.*join.*" ~/kubeadm-init.log
    kubeadm join --token $(kubeadm token list |sed -n 2p|egrep -o '^\S+') $(sed -rn s,.*server:.*//,,p /etc/kubernetes/admin.conf)

    # tmate ftW
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
  9. jjo revised this gist Aug 17, 2017. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    #!/bin/bash -x
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo
    # YEAH I TRUST RUNNING STUFF DIRECTLY AS ROOT way ->
    #
    # bash -x <( curl -L bit.do/jjo-pwk-sh )
    #
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

    # Initialize cluster and FIXUP some play-with-k8s annoyances
    test -f ~/kubeadm-init.log || (
    @@ -13,14 +15,14 @@ kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--se

    # k8s comfy'ness
    cd
    yum -qy install bash-completion git-core tmux vim wget sudo which > /dev/null
    yum -q -y install bash-completion git-core tmux vim wget sudo which > /dev/null
    kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # dev tools and latest GO
    yum -qy install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    yum -q -y install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
    tar -C /usr/local -xvzf go1.8.linux-amd64.tar.gz
    tar -C /usr/local -xzf go1.8.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go /usr/local/bin/go

    # jjo'isms
    @@ -35,4 +37,3 @@ grep -o "kubeadm.*join.*" ~/kubeadm-init.log
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    script -qfc tmate |egrep -o ssh.session:.*

  10. jjo revised this gist Aug 17, 2017. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -13,25 +13,26 @@ kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--se

    # k8s comfy'ness
    cd
    yum install -y bash-completion git-core tmux vim wget sudo which >& yum-0.log
    yum -qy install bash-completion git-core tmux vim wget sudo which > /dev/null
    kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # dev tools and latest GO
    yum -y install gcc gcc-go gcc-c++ make strace lsof
    yum -qy install gcc gcc-go gcc-c++ make strace lsof > /dev/null
    curl -LO https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
    tar -C /usr/local -xvzf go1.8.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go /usr/local/bin/go

    # jjo'isms
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config/
    git clone http://github.com/jjo/bin

    # show kubeadm join ...
    echo "* Join nodes with:"
    grep -o "kubeadm.*join.*" ~/kubeadm-init.log

    # tmate ftW
    wget https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    wget -q https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    script -qfc tmate |egrep -o ssh.session:.*

  11. jjo revised this gist Aug 17, 2017. 1 changed file with 7 additions and 8 deletions.
    15 changes: 7 additions & 8 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,9 @@
    #
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

    # FIXUP some play-with-k8s annoyances
    kubectl cluster-info || (
    kubeadm init --apiserver-advertise-address $(hostname -i)
    # Initialize cluster and FIXUP some play-with-k8s annoyances
    test -f ~/kubeadm-init.log || (
    kubeadm init --apiserver-advertise-address $(hostname -i) | tee ~/kubeadm-init.log
    kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 -w0)"
    curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | kubectl apply -f -
    kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--server)=(/ip6.arpa/.*),&\n\1=8.8.8.8,'|kubectl apply -f -
    @@ -27,12 +27,11 @@ ln -sf /usr/local/go/bin/go /usr/local/bin/go
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config
    git clone http://github.com/jjo/bin

    # re-echo the node join CLI
    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
    # show kubeadm join ...
    echo "* Join nodes with:"
    grep -o "kubeadm.*join.*" ~/kubeadm-init.log

    # tmate ftW
    wget https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    echo "Connect to address about to be shown, then:"
    echo "pkill -1 tmate"
    echo "* Connect to address about to be shown, then run : pkill -1 tmate"
    script -qfc tmate |egrep -o ssh.session:.*

  12. jjo revised this gist Aug 16, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash -x
    # curl -L bit.do/jjo-pwk-sh | bash -x
    # bash -x <( curl -L bit.do/jjo-pwk-sh )
    #
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

  13. jjo revised this gist Aug 16, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -27,12 +27,12 @@ ln -sf /usr/local/go/bin/go /usr/local/bin/go
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config
    git clone http://github.com/jjo/bin

    # re-echo the node join CLI
    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"

    # tmate ftW
    wget https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    exec bash
    script -qfc tmate |egrep -o ssh.session:.* &
    ## connect, then release browser "terminal" with:
    echo "Connect to address about to be shown, then:"
    echo "pkill -1 tmate"
    script -qfc tmate |egrep -o ssh.session:.*

    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
  14. jjo revised this gist Aug 16, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #!/bin/bash -x
    # curl -L bit.do/jjo-pwk-sh | bash -x
    #
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

    # FIXUP some play-with-k8s annoyances
  15. jjo revised this gist Aug 16, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -33,4 +33,4 @@ script -qfc tmate |egrep -o ssh.session:.* &
    echo "Connect to address about to be shown, then:"
    echo "pkill -1 tmate"

    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
  16. jjo revised this gist Aug 16, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,16 @@
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

    # FIXUP some play-with-k8s annoyances
    kubectl cluster-info || (
    kubeadm init --apiserver-advertise-address $(hostname -i)
    kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 -w0)"
    curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | kubectl apply -f -
    kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--server)=(/ip6.arpa/.*),&\n\1=8.8.8.8,'|kubectl apply -f -
    )

    # k8s comfy'ness
    cd
    yum install -y bash-completion git-core tmux vim wget sudo which
    yum install -y bash-completion git-core tmux vim wget sudo which >& yum-0.log
    kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    @@ -30,3 +32,5 @@ script -qfc tmate |egrep -o ssh.session:.* &
    ## connect, then release browser "terminal" with:
    echo "Connect to address about to be shown, then:"
    echo "pkill -1 tmate"

    echo "kubeadm join --token=$(kubeadm token list|sed -nr '/bootstrap/s/ .+//p') $(hostname -i)"
  17. jjo created this gist Aug 16, 2017.
    32 changes: 32 additions & 0 deletions play-with-k8s.com-jjo-setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/bin/bash -x
    ## Setup http://labs.play-with-k8s.com/ env ala' jjo

    # FIXUP some play-with-k8s annoyances
    kubeadm init --apiserver-advertise-address $(hostname -i)
    kubectl apply -n kube-system -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 -w0)"
    curl -L -s https://git.io/kube-dashboard | sed 's/targetPort: 9090/targetPort: 9090\n type: LoadBalancer/' | kubectl apply -f -
    kubectl get deployment --namespace=kube-system kube-dns -oyaml|sed -r 's,(.*--server)=(/ip6.arpa/.*),&\n\1=8.8.8.8,'|kubectl apply -f -

    # k8s comfy'ness
    cd
    yum install -y bash-completion git-core tmux vim wget sudo which
    kubectl completion bash > /etc/bash_completion.d/kubectl.completion
    source /etc/bash_completion.d/kubectl.completion

    # dev tools and latest GO
    yum -y install gcc gcc-go gcc-c++ make strace lsof
    curl -LO https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
    tar -C /usr/local -xvzf go1.8.linux-amd64.tar.gz
    ln -sf /usr/local/go/bin/go /usr/local/bin/go

    # jjo'isms
    git clone http://github.com/jjo/config; rsync -a config/ ~/ && rm -rf config
    git clone http://github.com/jjo/bin

    # tmate ftW
    wget https://github.com/tmate-io/tmate/releases/download/2.2.1/tmate-2.2.1-static-linux-amd64.tar.gz && tar zxf tmate-*.tar.gz && ln -sf $PWD/tmate-*/tmate /usr/local/bin
    exec bash
    script -qfc tmate |egrep -o ssh.session:.* &
    ## connect, then release browser "terminal" with:
    echo "Connect to address about to be shown, then:"
    echo "pkill -1 tmate"