63-Configure the K3s “Pool” 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

Create a Pool LoadBalancer

  1. Modify vip-pool in Harvester settings. image

  2. Open Kubectl shell.

  3. Create test-pool-lb.yaml file.

    apiVersion: v1
    kind: Service
    metadata:
      annotations:
        cloudprovider.harvesterhci.io/ipam: pool
      name: test-pool-lb
      namespace: default
    spec:
      ports:
      - name: http
        nodePort: 32155
        port: 8080
        protocol: TCP
        targetPort: 80
      selector:
        test: test
      sessionAffinity: None
      type: LoadBalancer
    
  4. Run k apply -f test-pool-lb.yaml to apply it.

  5. The Pool LoadBalancer should get an IP from vip-pool and work.

Expected Results

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