檢視次數:
如果您使用的是裸機 Kubernetes 叢集或不支援 LoadBalancer 服務的雲端供應商,您可以使用 MetalLB 來公開您的 ICAP 服務。

步驟

  1. 在 MicroK8s 中安裝 MetalLB
    # Enable MetalLB with an appropriate IP range for your network
    # Replace the IP range with one suitable for your network
    microk8s enable metallb:192.168.1.200-192.168.1.220
    
    注意
    注意
    選擇 IP 範圍時:
    • 確保它在您本地的子網路內
    • 避免與您 DHCP 伺服器的範圍衝突
    • 選擇尚未指派給其他裝置的 IP
  2. 使用以下內容更新 my-values.yaml:
    scanner:
      # Other scanner settings remain unchanged
      externalService:
        enabled: true
        type: LoadBalancer  # This creates an NLB
        annotations: {}
        icapPort: 1344
    
  3. 使用 MetalLB 配置更新部署:
    Run the following:
    helm upgrade my-release visionone-filesecurity/visionone-filesecurity \
      -n visionone-filesecurity \
      -f my-values.yaml
    
  4. 驗證 MetalLB 部署:
    # Check the service status
    kubectl get service -n visionone-filesecurity | grep scanner-lb
    
    # Get the external IP assigned by MetalLB
    EXTERNAL_IP=$(kubectl get service -n visionone-filesecurity my-release-visionone-filesecurity-scanner-lb -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    echo "Your MetalLB external IP is: $EXTERNAL_IP"
    
  5. 安裝並使用 c-icap-client 測試您的連線:
    # Install c-icap-client
    sudo apt-get install c-icap
    
    # Test with file scanning
    c-icap-client -i $EXTERNAL_IP -s scan -p 1344 -f sample.txt -x "X-scan-file-name: sample.txt"