Kubernetes in 10 mins

$script = <<-SHELLecho installing DOCKERapt-get updateapt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -ycurl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"apt-get updateapt-get install docker-ce docker-ce-cli -y
echo installing K*Ssudo apt-get update && sudo apt-get install -y apt-transport-https curlcurl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.listdeb https://apt.kubernetes.io/ kubernetes-xenial mainEOFsudo apt-get updatesudo apt-get install -y kubelet kubeadm kubectlsudo apt-mark hold kubelet kubeadm kubectl
systemctl daemon-reloadsystemctl restart kubeletecho KUBEADM INITkubeadm init --apiserver-cert-extra-sans=$(/sbin/ip -o -4 addr list enp0s8 | awk '{print $4}' | cut -d/ -f1)echo KUBEADM POST CONFIGSmkdir -p $HOME/.kubemkdir /home/vagrant/.kubecp -i /etc/kubernetes/admin.conf $HOME/.kube/configcp -i /etc/kubernetes/admin.conf /home/vagrant/.kube/configchown $(id -u):$(id -g) $HOME/.kube/configchown vagrant:vagrant /home/vagrant/.kube/configecho ADDING BASH COMPLETIONecho 'source <(kubectl completion bash)' >>/home/vagrant/.bashrc
echo DEPLOYING CALICOkubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yamlecho UNTAINT ADMIN NODEkubectl taint nodes --all node-role.kubernetes.io/master-echo DEPLOYING NGINXkubectl apply -f https://k8s.io/examples/application/deployment.yaml

echo Installing HELMcurl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3chmod 700 get_helm.sh./get_helm.shecho CONFIGURING HELMhelm repo add stable https://kubernetes-charts.storage.googleapis.com
echo DEPLOYING MONITORINGkubectl create ns monitorhelm install prometheus-operator stable/prometheus-operator --namespace monitor
echo DEPLOYING LOGGINGkubectl create ns logginghelm repo add loki https://grafana.github.io/loki/chartshelm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.comhelm repo updatehelm install --namespace logging loki loki/lokihelm install --namespace logging logging-demo banzaicloud-stable/logging-demo --set "loki.enabled=True"helm install --namespace logging grafana stable/grafana \ --set "datasources.datasources\\.yaml.apiVersion=1" \ --set "datasources.datasources\\.yaml.datasources[0].name=Loki" \ --set "datasources.datasources\\.yaml.datasources[0].type=loki" \ --set "datasources.datasources\\.yaml.datasources[0].url=http://loki:3100" \ --set "datasources.datasources\\.yaml.datasources[0].access=proxy"
helm install --namespace logging logging-demo banzaicloud-stable/logging-demo --set "loki.enabled=True"kubectl -n logging apply -f - <<"EOF"apiVersion: logging.banzaicloud.io/v1beta1kind: Loggingmetadata:  name: default-logging-simplespec:  fluentd: {}  fluentbit: {}  controlNamespace: loggingEOF
kubectl -n logging apply -f - <<"EOF"apiVersion: logging.banzaicloud.io/v1beta1kind: Outputmetadata: name: loki-outputspec: loki:   url: http://loki:3100   configure_kubernetes_labels: true   buffer:     timekey: 1m     timekey_wait: 30s     timekey_use_utc: trueEOFkubectl -n logging apply -f - <<"EOF"apiVersion: logging.banzaicloud.io/v1beta1kind: Flowmetadata:  name: loki-flowspec:  filters:    - tag_normaliser: {}    - parser:        remove_key_name_field: true        reserve_data: true        parse:          type: nginx  match:    - select:        labels:          app.kubernetes.io/name: log-generator  outputRefs:    - loki-outputEOF

kubectl -n logging apply -f - <<"EOF"apiVersion: apps/v1kind: Deploymentmetadata: name: log-generatorspec: selector:   matchLabels:     app.kubernetes.io/name: log-generator replicas: 1 template:   metadata:     labels:       app.kubernetes.io/name: log-generator   spec:     containers:     - name: nginx       image: banzaicloud/log-generator:0.3.2EOFapt install jq -ykubectl -n logging get secrets grafana -o json | jq '.data | map_values(@base64)'echo "kubectl -n logging port-forward svc/grafana 3000:80"
SHELL
Vagrant.configure("2") do |config|  config.vm.box = "ubuntu/xenial64"  config.disksize.size = "30GB"  config.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)"  config.vm.provider "virtualbox" do |vb|     vb.memory = "4000"     vb.cpus =  "4"  end  config.vm.provision "shell", inline: $scriptend