kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.51k stars 14.46k forks source link

Clarify hostPath mount behaviour when file doesn't exist on host #32422

Open pranavmarla opened 2 years ago

pranavmarla commented 2 years ago

Problem

This is the current hostPath documentation for the type param, with the first two rows highlighted:

hostpath-type

Row 1 handles the case when no value is provided for type. As you can see, it doesn't actually specify what will happen in this case if the file you are trying to mount from the underlying host doesn't exist -- I assumed nothing would happen but, in actuality, it seems to follow the behaviour of row 2! i.e. When I try to mount a nonexistent file test.log from the underlying host, and I have not specified any value for type, Kubernetes creates an empty directory named test.log at that location -- the same behaviour that I would expect to see if I had set type to DirectoryOrCreate!

In addition, I assumed from reading the documentation that, even in the case of row 2, the new directory would be created in the container's file system and that the underlying host file system would be unaffected -- to my surprise, this was not the case: The empty directory that is created is done so on the underlying host file system itself!

Proposed Changes

So, my suggestions to make this doc clearer:

  1. Edit row 1 to clarify that, if the file you're trying to mount doesn't exist on the host, you will see the same behaviour as what is specified in row 2.
  2. Edit rows 2 (DirectoryOrCreate) and 4 (FileOrCreate) to clarify that the empty directory/file that is created is done so on the underlying host file system itself, outside the container!

ps: My assumption is that both the above behaviours are expected, and it's just a matter of documenting them. If they are NOT expected, then let me know if I should open an actual bug report to the main Kubernetes repo.

Config

volumes:
  - name: test
    hostPath:
      path: /var/log/test.log

Environment

k8s-triage-robot commented 2 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

RA489 commented 2 years ago

/remove-lifecycle stale

k8s-triage-robot commented 2 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

RA489 commented 2 years ago

/close

k8s-ci-robot commented 2 years ago

@RA489: Closing this issue.

In response to [this](https://github.com/kubernetes/website/issues/32422#issuecomment-1261151101): >/close 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.
pranavmarla commented 2 years ago

/close

Hey @RA489 , I see that you closed this issue -- has it been fixed?

RA489 commented 2 years ago

Hi @pranavmarla – is this issue still occurring? Are additional details available? If so, please feel free to re-open the issue by commenting with /reopen. This issue will be closed as additional information was unavailable and some time has passed.

pranavmarla commented 2 years ago

Hi @pranavmarla – is this issue still occurring? Are additional details available? If so, please feel free to re-open the issue by commenting with /reopen. This issue will be closed as additional information was unavailable and some time has passed.

Thanks. I initially opened the issue because it seemed like the documentation was missing some important details -- looks like that's still the case, so I'll reopen it for now:

/reopen

k8s-ci-robot commented 2 years ago

@pranavmarla: Reopened this issue.

In response to [this](https://github.com/kubernetes/website/issues/32422#issuecomment-1262326322): >> Hi @pranavmarla – is this issue still occurring? Are additional details available? If so, please feel free to re-open the issue by commenting with /reopen. This issue will be closed as additional information was unavailable and some time has passed. > >Thanks. I initially opened the issue because it seemed like the documentation was missing some important details -- looks like that's still the case, so I'll reopen it for now > >/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.
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

RA489 commented 2 years ago

/remove-lifecycle rotten

k8s-triage-robot commented 1 year 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

divya-mohan0209 commented 1 year ago

/sig storage

divya-mohan0209 commented 1 year ago

/remove-lifecycle stale

divya-mohan0209 commented 1 year ago

@ sig storage folks, please could you confirm if this is expected behavior & if it is, we will open this up for contributions.

k8s-triage-robot commented 4 months ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

k8s-triage-robot commented 1 month ago

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

This bot triages un-triaged issues according to the following rules:

You can:

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

/lifecycle stale

skitt commented 1 month ago

/remove-lifecycle stale