Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nimmis/vagrant-k3s-cluster
K3S minicluster on Alpine/Ubuntu/Centos OS deployed with vagrant
https://github.com/nimmis/vagrant-k3s-cluster
k3s-minicluster kubernetes kubernetes-cluster vagrant
Last synced: 6 days ago
JSON representation
K3S minicluster on Alpine/Ubuntu/Centos OS deployed with vagrant
- Host: GitHub
- URL: https://github.com/nimmis/vagrant-k3s-cluster
- Owner: nimmis
- Created: 2019-09-11T19:53:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-08T10:43:59.000Z (about 3 years ago)
- Last Synced: 2024-11-10T01:18:45.238Z (2 months ago)
- Topics: k3s-minicluster, kubernetes, kubernetes-cluster, vagrant
- Language: Shell
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kubernetes k3 minicluster with vagrant
K3S minicluster on Alpine OS deployed with vagrant
## manage cluster from host machine
Get the kubernet config file from guest and save it in a file named k3s-confg
./get-config.sh > 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 viewTo remove the export and let kubectl use "default" settings again
unset KUBECONFIG
## getting kube config file from guest
./get-config.sh > k3s-config
## Downloading kubectl
### Linux
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
### Mac OS
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
### Windows
#### with curl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/windows/amd64/kubectl.exe
#### with powershell
Install-Script -Name install-kubectl -Scope CurrentUser -Force
install-kubectl.ps1 [-DownloadLocation ]## Using kubectl with k3s-config
$> kubectl --kubeconfig=./k3s-config get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 35m v1.14.6-k3s.1## Deploy app with ingress access
### Deploy cafe app
kubectl apply -f examples/cafe.yaml
### Deploy cafe.example.com certificat
kubectl apply -f examples/cafe.example.com-secret.yaml
### Deploy cafe.example.com w/o coffee and tea
kubectl apply -f examples/cafe_only-ingress.yaml
### test access to app
C_PORT=8443
C_HOST=127.0.0.1curl --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### add apps for coffee and tea
kubectl apply -f examples/coffee.yaml
kubectl apply -f examples/tea.yaml### deploy ingress with coffee and tea
kubectl apply -f examples/cafe_coffee_and_tea-ingress.yaml
### check to see that url talks to different apps
C_PORT=8443
C_HOST=127.0.0.1curl --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: 5624132df85d187692df6c51bf2cca57curl --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: 585bd3ea1ad1de6dddda9b0d5f99f6a7curl --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### remove demo application
kubectl delete namespace cafeexample