kubernetes / examples

Kubernetes application example tutorials
Apache License 2.0
6.21k stars 4.54k forks source link

Failed to resolve server nfs-server.default.svc.cluster.local: Name or service not known #418

Closed Azbesciak closed 2 years ago

Azbesciak commented 3 years ago

Hello, I tried to use example for NFS server, with the only change that I changed in nfs-server-rc.yml persistentVolumeClaim to

hostPath:
     path: /path/on/my/machine

I applied all NFS samples in a given order (rc, service, pv, pvc) but when I try to consume it via pvc in my job I receive an error like below

MountVolume.SetUp failed for volume "nfs" : mount failed: exit status 32 Mounting command: mount
Mounting arguments: -t nfs nfs-server.default.svc.cluster.local:/ /var/lib/kubelet/pods/5f4d4cce-ab59-44cb-9311-ef5fef696902/volumes/kubernetes.io~nfs/nfs
Output: mount.nfs: Failed to resolve server nfs-server.default.svc.cluster.local: Name or service not known

Do you have any idea how to solve this? I saw in https://github.com/kubernetes/minikube/issues/3417 that I am not the one facing this issue, but I suppose that if you placed this as an example, it should work. I am using Docker for Windows with the following spec

Also, I think I can but not sure - can I consume a single pv with multiple pvc, assuming ReadWriteMany? Worth to mention is that I aim to have jobs in different namespaces. I assume that each namespace must have at least dedicated for it pvc (I cannot have one global)? In general, I am looking for some substitute of hostPath - without NFS, but hostPath doest not work with multi-node cluster, so...

Thanks!

Azbesciak commented 3 years ago

Hello, could you please take a look at this?

adthonb commented 3 years ago

@Azbesciak I have the same issue. You can't use the DNS of Service. Use Cluster-IP of Service instead. Change server: value in nfs-pv.yaml

Azbesciak commented 3 years ago

Yup, take a look at https://github.com/kubernetes/minikube/issues/3417#issuecomment-670005434 But I rather expected some solution from k8s team.

ronald commented 3 years ago

We also had no success with the fqdn, although it's in the example since 2019: https://github.com/kubernetes/examples/pull/295 by @IronPan

k8s-triage-robot commented 3 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-ci-robot commented 2 years ago

@k8s-triage-robot: Closing this issue.

In response to [this](https://github.com/kubernetes/examples/issues/418#issuecomment-1001491538): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues and PRs according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
HusseinKabbout commented 2 years ago

I think it would be good to revert this commit, as it misleads the reader to believe that using the FQDN of the NFS service should work (even though it doesn't).

From my understand, currently there are only two somewhat reasonable solutions for this problem:

  1. Use the services IP instead of the FQDN
  2. Manually update the nodes hosts file (/etc/hosts) to make using the FQDN work

/reopen

k8s-ci-robot commented 2 years ago

@HusseinKabbout: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to [this](https://github.com/kubernetes/examples/issues/418#issuecomment-1075543624): >I think it would be good to revert this [commit](https://github.com/kubernetes/examples/pull/295/files), as it misleads the reader to believe that using the FQDN of the NFS service should work (even though it doesn't). > >From my understand, currently there are only two somewhat reasonable solutions for this problem: > >1. Use the services IP instead of the FQDN >2. Manually update the nodes hosts file (`/etc/hosts`) to make using the FQDN work > >/reopen Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.