Prerequisite: Already provision K3s cluster and cloud provider on test plan
- 59-Create K3s Kubernetes Cluster
- 61-Deploy Harvester cloud provider to k3s Cluster
Create Nginx workload for testing
- Create a test-nginx deployment with image nginx:latest.
- Add pod label test: test.
Create a DHCP LoadBalancer
- Open Kubectl shell.
- Create
test-dhcp-lb.yaml
file.apiVersion: v1 kind: Service metadata: annotations: cloudprovider.harvesterhci.io/ipam: dhcp name: test-dhcp-lb namespace: default spec: ports: - name: http nodePort: 30172 port: 8080 protocol: TCP targetPort: 80 selector: test: test sessionAffinity: None type: LoadBalancer
- Run
k apply -f test-dhcp-lb.yaml
to apply it. - The Pool LoadBalancer should get an IP from vip-pool and work.
Expected Results
- Can create load balance service correctly
- Can route workload to nginx deployment