Let's take some of the concepts we learned and apply them in some resources of your own creation!
-
Create the following file:
student@bchd:~$vim gameinfo.ymlgame: Super Mario Bros. publisher: Nintendo director: Shigeru Miyamoto release: September 13, 1985 -
Put
gameinfo.ymlinside a configmap namednintendo. -
Create a PersistentVolume with the following parameters:
- 2GB storage
- name:
persistentchallenge - storage class: manual
- host path: /mnt/data
-
Create a PersistentVolumeClaim with the following parameters:
- 1GB storage
- name:
persistentclaimchallenge - storage class: manual
-
Create a Pod with the following:
- name the Pod
day4challenge - give the Pod the label
k8s: isawesome - Use a
nginximage - Mount BOTH the PVC
persistentclaimchallengeAND configmapnintendo.
The
mountPathlocation is up to you, but the Pod status must beRUNNINGto complete the challenge :)
SOLUTION
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: persistentchallenge
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: persistentclaimchallenge
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
name: day4challenge
labels:
k8s: isawesome
spec:
containers:
- name: warmup
image: nginx
volumeMounts:
- mountPath: "/var/www/"
name: mypvc
- mountPath: "/data"
name: myconfig
volumes:
- name: mypvc
persistentVolumeClaim:
claimName: persistentclaimchallenge
- name: myconfig
configMap:
name: nintendo