K3S minicluster on Alpine OS deployed with vagrant
Get the kubernet config file from guest and save it in a file named k3s-confg
./get-config.sh <master name> > k3s-config
You can then address the k3s by adding the flag --kubeconfig=./k3s-config to the kubectl command
kubectl --kubeconfig=./k3s-config config view
but the best way is to export a environmentvariable for kubectl so that i uses the configuration file by default
export KUBECONFIG="$(pwd)/k3s-config"
kubectl config view
To remove the export and let kubectl use "default" settings again
unset KUBECONFIG
./get-config.sh <master name> > k3s-config
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/windows/amd64/kubectl.exe
Install-Script -Name install-kubectl -Scope CurrentUser -Force
install-kubectl.ps1 [-DownloadLocation <path>]
$> kubectl --kubeconfig=./k3s-config get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 35m v1.14.6-k3s.1
kubectl apply -f examples/cafe.yaml
kubectl apply -f examples/cafe.example.com-secret.yaml
kubectl apply -f examples/cafe_only-ingress.yaml
C_PORT=8443
C_HOST=127.0.0.1
curl --resolve cafe.example.com:$C_PORT:$C_HOST https://cafe.example.com:$C_PORT/ --insecure
Server address: 10.42.0.11:80
Server name: cafe-77654cbdbb-qffsw
Date: 15/Sep/2019:17:59:18 +0000
URI: /
Request ID: 426ebf8761a84facdb65486e9f2907b8
curl --resolve cafe.example.com:$C_PORT:$C_HOST https://cafe.example.com:$C_PORT/coffee --insecure
kubectl apply -f examples/coffee.yaml
kubectl apply -f examples/tea.yaml
kubectl apply -f examples/cafe_coffee_and_tea-ingress.yaml
C_PORT=8443
C_HOST=127.0.0.1
curl --resolve cafe.example.com:$C_PORT:$C_HOST https://cafe.example.com:$C_PORT/ --insecure
Server address: 10.42.0.11:80
Server name: cafe-77654cbdbb-qffsw
Date: 15/Sep/2019:18:01:21 +0000
URI: /
Request ID: 5624132df85d187692df6c51bf2cca57
curl --resolve cafe.example.com:$C_PORT:$C_HOST https://cafe.example.com:$C_PORT/coffee --insecure
Server address: 10.42.0.6:80
Server name: coffee-bbd45c6-42mhw
Date: 15/Sep/2019:18:02:46 +0000
URI: /coffee
Request ID: 585bd3ea1ad1de6dddda9b0d5f99f6a7
curl --resolve cafe.example.com:$C_PORT:$C_HOST https://cafe.example.com:$C_PORT/tea --insecure
Server address: 10.42.0.6:80
Server name: coffee-bbd45c6-42mhw
Date: 15/Sep/2019:18:03:16 +0000
URI: /tea
Request ID: 585bd3ea1ad1de6dddda9b0d5f99f6a7
Server address: 10.42.0.6:80
kubectl delete namespace cafeexample