https://github.com/kubernetes/kubernetes/pull/35652 ํฌ๋์์ nfs ๋ณผ๋ฅจ ๋ง์ดํธ๋ฅผ ์ค๋จํ์ต๋๋ค.
apiVersion: v1
kind: Pod
metadata:
name: demo
spec:
containers:
- image: fedora:24
name: fedora
imagePullPolicy: Always
command:
- /usr/bin/sleep
- "3600"
volumeMounts:
- name: myvol
mountPath: /mnt
volumes:
- name: myvol
nfs:
path: /srv/share
server: localhost
terminationGracePeriodSeconds: 5
kubectl create -f nfspod.yaml
ContainerCreating
๊ฐํ
kubectl describe pod demo
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
14s 14s 1 {default-scheduler } Normal Scheduled Successfully assigned demo to 127.0.0.1
14s 6s 5 {kubelet 127.0.0.1} Warning FailedMount MountVolume.SetUp failed for volume "kubernetes.io/nfs/3cc8bac7-9c77-11e6-ae11-fa163e815edd-myvol" (spec.Name: "myvol") pod "3cc8bac7-9c77-11e6-ae11-fa163e815edd" (UID: "3cc8bac7-9c77-11e6-ae11-fa163e815edd") with: mount failed: exit status 32
Mounting command: mount
Mounting arguments: /localhost:/srv/share /var/lib/kubelet/pods/3cc8bac7-9c77-11e6-ae11-fa163e815edd/volumes/kubernetes.io~nfs/myvol nfs []
Output: mount.nfs: Failed to resolve server /localhost: Name or service not known
nfs ์๋ฒ ์ด๋ฆ์ ์ ํ /
์ ์ ์ํ์ญ์์ค.
@vshh @derekwaynecarr
https://github.com/kubernetes/kubernetes/pull/35349/commits/7fd03c4b6e132347cfa591abb263b92a53d004b1์์ ์์ ํด์ผ ํฉ๋๋ค. ๋ฌธ์ ๋ฅผ ์ผ์ผ์ผ์ ๋ฏธ์ ํด์.
@vishh ์ ์, ํด๋น ์์ ์ฌํญ์ผ๋ก PR์ ์ค๋นํ์ง๋ง ๋น์ ์ด ์ ๋ฅผ ์ด๊ฒผ์ต๋๋ค. ๋ง์ด๋์ค ์ ์ฒด else
๊ฒฝ์ฐ๊ฐ ์ดํ if
๊ทธ๊ฒ์ผ๋ก ์ข
๋ฃ๋๊ธฐ ์ ์ return
. ๊ฐ์ฌ ํด์! ํฉ์ณ์ง๋ฉด ๋ซ์๊ฒ
์ด๋ด,
NFS ๋ง์ดํธ๋ ์ฌ์ ํ GCE์์ ์๋น์ค ํธ์คํธ ์ด๋ฆ(service.namespace)์ ํ์ธํ ์ ์์ต๋๋ค.
์ด ๋ฌธ์ ๊ฐ ์์ ๋ฐ ๋ณํฉ๋์์ต๋๊น? ์๋๋ฉด GCE์์ ํด๊ฒฐ๋๋ ๋ฐ ์ฌ์ ํ ์๊ฐ์ด ์ข ๊ฑธ๋ฆฌ๋์?
MountVolume.SetUp failed for volume "kubernetes.io/nfs/***" (spec.Name: "***") pod "***" (UID: "***") with: mount failed: exit status 32 Mounting command: mount Mounting arguments: nfs-server:/exports/jenkins-master /var/lib/kubelet/pods/***/volumes/kubernetes.io~nfs/jenkins-master nfs [] Output: mount.nfs: Failed to resolve server nfs-server.storage: Name or service not known
์คํ ์ค์ธ ์ปจํ ์ด๋๊ฐ ์ด๋ฆ์ ํ์ธํ ์ ์์ผ๋ฏ๋ก DNS๊ฐ ์ ๋๋ก ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋ํ IP๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ ์ข์ง๋ง ํด๊ฒฐ์ฑ ์ ์๋๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๋ด,
NFS ๋ง์ดํธ๋ ์ฌ์ ํ GCE์์ ์๋น์ค ํธ์คํธ ์ด๋ฆ(service.namespace)์ ํ์ธํ ์ ์์ต๋๋ค.
์ด ๋ฌธ์ ๊ฐ ์์ ๋ฐ ๋ณํฉ๋์์ต๋๊น? ์๋๋ฉด GCE์์ ํด๊ฒฐ๋๋ ๋ฐ ์ฌ์ ํ ์๊ฐ์ด ์ข ๊ฑธ๋ฆฌ๋์?
์คํ ์ค์ธ ์ปจํ ์ด๋๊ฐ ์ด๋ฆ์ ํ์ธํ ์ ์์ผ๋ฏ๋ก DNS๊ฐ ์ ๋๋ก ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋ํ IP๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ ์ข์ง๋ง ํด๊ฒฐ์ฑ ์ ์๋๋๋ค.