From ed68c7d59ee3d4ff5c37ee6671d61f2a05903676 Mon Sep 17 00:00:00 2001 From: Bill Plein <260078+bplein@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:00:40 -0600 Subject: [PATCH] adding kube-ps1 k8s aware prompt makes a pretty command line --- vagrant/all-master | 5 +++++ vagrant/k8s-master | 1 + 2 files changed, 6 insertions(+) diff --git a/vagrant/all-master b/vagrant/all-master index 6a3cf22..772629a 100644 --- a/vagrant/all-master +++ b/vagrant/all-master @@ -3,10 +3,15 @@ mv /tmp/assets /assets echo 'source <(kubectl completion bash 2>/dev/null)' >>/etc/bash_completion.d/kubectl echo 'source <(oc completion bash 2>/dev/null)' >>/etc/bash_completion.d/oc +curl -sLO https://raw.githubusercontent.com/jonmosco/kube-ps1/refs/tags/v0.9.0/kube-ps1.sh +mv kube-ps1.sh /usr/local/bin +chmod +x /usr/local/bin/kube-ps1.sh { echo 'alias k=kubectl' echo "alias watch='watch --color '" echo 'complete -F __start_kubectl k' + echo "source /usr/local/bin/kube-ps1.sh" + echo "PS1='[\u@\h \W \$(kube_ps1)]\$ '" } >>/root/.bashrc cat </etc/exports / 10.0.0.0/8(rw,no_root_squash) diff --git a/vagrant/k8s-master b/vagrant/k8s-master index 040d817..74c3836 100644 --- a/vagrant/k8s-master +++ b/vagrant/k8s-master @@ -23,3 +23,4 @@ kubectl label node $(hostname) node-role.kubernetes.io/master=master echo "Applying Flannel" kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/v0.25.1/Documentation/kube-flannel.yml +kubectl config set-context --current --namespace=default \ No newline at end of file