0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CKA試験、PersistentVolume Claims

Posted at

PersistentVolume Claims

次の条件に合う、新しいPersistentVolumeClaimを作成しなさい

  • 名前: pv-volume
  • class: app-hostpath-sc
  • capacity: 10Mi

pv-volume PersistentVolumeClaimをマウントするPodを作成しなさい

  • name: web-server-pod
  • image: nginx
  • MountPath: /usr/share/nginx/html
  • Volume でReadWriteManyアクセス権限を持つように構成する
vi pv-volume.yaml
pv-volume.yaml
(修正前)pv-volume.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 8Gi
  storageClassName: slow
  selector:
    matchLabels:
      release: "stable"
    matchExpressions:
      - {key: environment, operator: In, values: [dev]}
(修正後)pv-volume.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-volume # name 
spec:
  accessModes:
    - ReadWriteMany # 権限
  volumeMode: Filesystem
  resources:
    requests:
      storage: 10Mi
  storageClassName: app-hostpath-sc # class
kubectl apply -f ./pv-volume.yaml

vi web-server-pod.yaml
(修正前)web-server-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: web-server-pod
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: "/usr/share/nginx/html"
        name: mypd #mypdを利用する
  volumes:
    - name: mypd # mypd
      persistentVolumeClaim:
        claimName: pv-volume # pv-volumeを利用する
kubectl apply -f ./web-server-pod.yaml
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?