Execute on the current folder:
vagrant up
After the process finish, a new file will be created on the local folder (kubernetes_config.conf). This file is the k8s config file.
Use the KUBECONFIG environment variable to use this k8s instance.
export KUBECONFIG="$(pwd)/kubernetes_config.conf"
To test:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready control-plane,master 8m9s v1.22.2
node-1 Ready <none> 5m20s v1.22.2
node-2 Ready <none> 2m2s v1.22.2
Delete the env
vagrant destroy
Use suspend/resume to pause de execution
vagrant suspend
vagrant resume
Based on MetalLB doc
Enable strictARP
kubectl get configmap kube-proxy -n kube-system -o yaml | \
sed -e "s/strictARP: false/strictARP: true/" | \
kubectl apply -f - -n kube-system
Install MetalLB
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/metallb.yaml
Configure MetalLB
- Create a YAML file (metallb-conf.yaml)
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.165.100-192.168.165.250
- Apply the config file
kubectl apply -f metallb-conf.yaml