62-Configure the K3s “DHCP” LoadBalancer service

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

  1. Create a test-nginx deployment with image nginx:latest. image
  2. Add pod label test: test. image image

Create a DHCP LoadBalancer

  1. Open Kubectl shell.
  2. 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
    
  3. Run k apply -f test-dhcp-lb.yaml to apply it. image
  4. The Pool LoadBalancer should get an IP from vip-pool and work. image

Expected Results

  1. Can create load balance service correctly
  2. Can route workload to nginx deployment