3

What I Have:

A Kubernetes Deployment on a Cluster with Googles Container Optimized OS as Node OS

result of cat /etc/*-release

Further the deployment.yaml

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: eu.gcr.io/my-project/my-app
          ports:
          - containerPort: 8013

          volumeMounts:
          - mountPath: /my/cache/
            name: cache

       volumes:
       - name: cache
         nfs:
           server: cache
           path: /cache/my-app/
           readOnly: false

The problem is that the nfs-mount works when I explicitly enter the IP-Address but for whatever reason it is not possible to resolve the hostname.

volumes:
   - name: cache
     nfs:
       server: 192.168.1.1 # this example would work
       path: /cache/my-app/
       readOnly: false

However with the hostname entered mount.nfs exits with

Mount failed: exit status 32 ... Output: mount.nfs: Failed to resolve server cache

However I am able to ping the server by hostname from the Node. It also works when I use a normal Container-VM indicating it might be a problem with Googles Container Optimized OS...

How can I tell Kubernetes to resolve the server of the nfs-mount by hostname?

N Singh
  • 438
  • 3
  • 10
SklogW
  • 31
  • 1
  • This seems to be known issue tracked under github [1][2]. As workaround, You can "Copy the /etc/resolv.conf from the GCE VM (this will include the GCP search path, metadata DNS resolver) into the chroot env (/home/kubernetes/containerized_mounter/rootfs) directory" and use NFS FQDN eg: server-name.svc.cluster.local as hostname. [1] https://github.com/kubernetes/kubernetes/issues/48212 [2] https://github.com/kubernetes/kubernetes/pull/42376 – N Singh Aug 15 '17 at 18:17

1 Answers1

1

This seems to be known issue tracked under github [1][2]. As workaround, You can "Copy the /etc/resolv.conf from the GCE VM (this will include the GCP search path, metadata DNS resolver) into the chroot env (/home/kubernetes/containerized_mounter/rootfs) directory" and use NFS FQDN eg: server-name.svc.cluster.local as hostname.

In addition, Here is [3] the pull request(PR) on github to set up DNS server in containerized mounter path to resolve the hostname.

[1] https://github.com/kubernetes/kubernetes/issues/48212

[2] https://github.com/kubernetes/kubernetes/pull/42376

[3] https://github.com/kubernetes/kubernetes/pull/51645

N Singh
  • 438
  • 3
  • 10