From d1ebf58fcff4e217488ba5ef5aa3573ca7d9a9bf Mon Sep 17 00:00:00 2001 From: Harry Brundage Date: Fri, 2 Oct 2020 09:03:43 -0400 Subject: [PATCH] Update CSI yaml to allow using k8s service DNS to contact the filer I think lots of users are going to use the CSI driver with a seaweedfs cluster also running in k8s. The natural way to connect the driver to that cluster would be using DNS instead of hard coded IPs, so I set `SEAWEEDFS_FILER` to something like `seaweedfs-filer.seaweed-namespace.svc:8888`, which the driver kept timing out trying to connect. I realized the driver was running using `hostNetwork: true`, which means the in-cluster DNS resolution doesn't happen, so the .svc hostnames are just unresolved. This changes the default YAML for the next person coming along to use the in-cluster DNS resolution first, and then the host's DNS resolution, so that if the filer happens to be running the cluster, it can be connected from the driver running on the host. An alternative would be to not use `hostNetworking` for the driver daemonset, but I am presuming that's there for a reason. --- deploy/kubernetes/seaweedfs-csi.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/kubernetes/seaweedfs-csi.yaml b/deploy/kubernetes/seaweedfs-csi.yaml index 4a37ecf..bb3d222 100644 --- a/deploy/kubernetes/seaweedfs-csi.yaml +++ b/deploy/kubernetes/seaweedfs-csi.yaml @@ -330,6 +330,7 @@ spec: priorityClassName: system-node-critical serviceAccount: csi-seaweedfs-node-sa hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet containers: - name: driver-registrar image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.1 @@ -366,7 +367,7 @@ spec: - name: CSI_ENDPOINT value: unix:///csi/csi.sock - name: SEAWEEDFS_FILER - value: "192.168.2.7:8888" # host and port of your SeaweedFs filer + value: "192.168.2.7:8888" # host and port of your SeaweedFs filer, could also be K8S DNS entry like seaweedfs-filer.seaweed-namespace.svc:8888 - name: NODE_ID valueFrom: fieldRef: @@ -395,4 +396,4 @@ spec: type: Directory - name: device-dir hostPath: - path: /dev \ No newline at end of file + path: /dev