Skip to content
Snippets Groups Projects
Commit c845c3c9 authored by Chance Zibolski's avatar Chance Zibolski
Browse files

Don't pass $KUBECONFIG to kubectl --kubeconfig flag

The $KUBECONFIG variable is like $PATH, and supports multiple files
separated by `:`, but --kubeconfig only takes a single file as a value.
Since kubectl picks up the $KUBECONFIG variable already, don't pass it
to kubectl.

Also, use --namespace instead of -n to support older kubectl versions.
parent 70ab7eb2
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config
export KUBECONFIG=~/.kube/config
fi
if [ -z "${NAMESPACE}" ]; then
NAMESPACE=monitoring
fi
kubectl --kubeconfig="$KUBECONFIG" create namespace "$NAMESPACE"
kubectl create namespace "$NAMESPACE"
kctl() {
kubectl --kubeconfig="$KUBECONFIG" -n "$NAMESPACE" "$@"
kubectl --namespace "$NAMESPACE" "$@"
}
kctl create -f manifests/prometheus-operator.yaml
......
#!/usr/bin/env bash
if [ -z "${KUBECONFIG}" ]; then
KUBECONFIG=~/.kube/config
export KUBECONFIG=~/.kube/config
fi
if [ -z "${NAMESPACE}" ]; then
......@@ -9,7 +9,7 @@ if [ -z "${NAMESPACE}" ]; then
fi
kctl() {
kubectl --kubeconfig="$KUBECONFIG" -n "$NAMESPACE" "$@"
kubectl --namespace "$NAMESPACE" "$@"
}
kctl delete -f manifests/exporters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment