export kubernetes config:
# start a minikube adding external adresses to ssl certs
cloud$ ips="$(ip addr show | grep "inet " | awk '{print $2}' | sed 's/\/.*//' | xargs | sed -e 's/ /,/g')"
cloud$ minikube start --apiserver-ips="$ips" <other options>
# export the config
cloud$ kubectl config view --flatten
# copy config via scp
# patch ips (exchange potentailly local ips with external ones)
# update local configuration - script provided below
local$ mv kubeconfig ~/.kube/config-couldprovider
local$ kupdate-config
local$ kubectl get pod --all-namespaces
# kubernetes config import helper
kupdate-config() {
local configs=""
for file in "${HOME}/.kube/config-"* ; do
if [[ -f "$file" ]]; then
echo "adding config file $file to kubeconfig"
configs="${KUBECONFIG}:${file}"
fi
done
merged_config="$(KUBECONFIG="${configs}" kubectl config view --flatten)"
echo "$merged_config" > "${HOME}/.kube/config"
}
Links: