47 lines
1.9 KiB
Bash
Executable File
47 lines
1.9 KiB
Bash
Executable File
#!/bin/bash -ex
|
|
#
|
|
# Copyright 2018 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
#This scripts installs Minikube, configures it to run without root access and starts it without VM
|
|
#See https://github.com/kubernetes/minikube#linux-continuous-integration-without-vm-support
|
|
|
|
MINIKUBE_VERSION=${MINIKUBE_VERSION:-latest}
|
|
KUBECTL_VERSION=${KUBECTL_VERSION:-$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)}
|
|
KUBERNETES_VERSION=${KUBERNETES_VERSION:-v1.12.2}
|
|
|
|
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
|
|
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && sudo cp kubectl /usr/local/bin/ && rm kubectl
|
|
|
|
export MINIKUBE_WANTUPDATENOTIFICATION=false
|
|
export MINIKUBE_WANTREPORTERRORPROMPT=false
|
|
export MINIKUBE_HOME=$HOME
|
|
export CHANGE_MINIKUBE_NONE_USER=true
|
|
mkdir -p $HOME/.kube
|
|
touch $HOME/.kube/config
|
|
|
|
export KUBECONFIG=$HOME/.kube/config
|
|
sudo -E /usr/local/bin/minikube start --vm-driver=none --kubernetes-version=$KUBERNETES_VERSION
|
|
|
|
# this for loop waits until kubectl can access the api server that Minikube has created
|
|
for i in {1..150}; do # timeout for 5 minutes
|
|
kubectl get po &> /dev/null
|
|
if [ $? -ne 1 ]; then
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
# kubectl commands are now able to interact with Minikube cluster
|