Add Windows examples for hostPath
Allow seeing an example of hostPath on Linux and on Windows
This commit is contained in:
parent
a6338f8bf3
commit
ba4579ef43
|
|
@ -421,28 +421,64 @@ or modify the file permissions on the host to be able to read from
|
|||
|
||||
#### hostPath configuration example
|
||||
|
||||
This manifest mounts `/data` on the host as `/test-pd` inside the
|
||||
single container that runs within the `test-pd` Pod:
|
||||
|
||||
```yaml
|
||||
{{< tabs name="hostpath_examples" >}}
|
||||
{{< tab name="Linux node" codelang="yaml" >}}
|
||||
---
|
||||
# This manifest mounts /data/foo on the host as /foo inside the
|
||||
# single container that runs within the hostpath-example-linux Pod.
|
||||
#
|
||||
# The mount into the container is read-only.
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: test-pd
|
||||
name: hostpath-example-linux
|
||||
spec:
|
||||
os: { name: linux }
|
||||
nodeSelector:
|
||||
kubernetes.io/os: linux
|
||||
containers:
|
||||
- image: registry.k8s.io/test-webserver
|
||||
name: test-container
|
||||
- name: example-container
|
||||
image: registry.k8s.io/test-webserver
|
||||
volumeMounts:
|
||||
- mountPath: /test-pd
|
||||
name: test-volume
|
||||
- mountPath: /foo
|
||||
name: example-volume
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: test-volume
|
||||
- name: example-volume
|
||||
# mount /data/foo, but only if that directory already exists
|
||||
hostPath:
|
||||
path: /data # directory location on host
|
||||
path: /data/foo # directory location on host
|
||||
type: Directory # this field is optional
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab name="Windows node" codelang="yaml" >}}
|
||||
---
|
||||
# This manifest mounts C:\Data\foo on the host as C:\foo, inside the
|
||||
# single container that runs within the hostpath-example-windows Pod.
|
||||
#
|
||||
# The mount into the container is read-only.
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: hostpath-example-windows
|
||||
spec:
|
||||
os: { name: windows }
|
||||
nodeSelector:
|
||||
kubernetes.io/os: windows
|
||||
containers:
|
||||
- name: example-container
|
||||
image: microsoft/windowsservercore:1709
|
||||
volumeMounts:
|
||||
- name: example-volume
|
||||
mountPath: "C:\\foo"
|
||||
readOnly: true
|
||||
volumes:
|
||||
# mount C:\Data\foo from the host, but only if that directory already exists
|
||||
- name: example-volume
|
||||
hostPath:
|
||||
path: "C:\\Data\\foo" # directory location on host
|
||||
type: Directory # this field is optional
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
|
||||
#### hostPath FileOrCreate configuration example {#hostpath-fileorcreate-example}
|
||||
|
||||
|
|
@ -465,6 +501,9 @@ kind: Pod
|
|||
metadata:
|
||||
name: test-webserver
|
||||
spec:
|
||||
os: { name: linux }
|
||||
nodeSelector:
|
||||
kubernetes.io/os: linux
|
||||
containers:
|
||||
- name: test-webserver
|
||||
image: registry.k8s.io/test-webserver:latest
|
||||
|
|
|
|||
Loading…
Reference in New Issue