Skip to content

Latest commit

 

History

History
95 lines (82 loc) · 2.05 KB

File metadata and controls

95 lines (82 loc) · 2.05 KB

Thursday Morning Warmup!

Let's take some of the concepts we learned and apply them in some resources of your own creation!

  1. Create the following file:

    student@bchd:~$ vim gameinfo.yml

    game: Super Mario Bros.
    publisher: Nintendo
    director: Shigeru Miyamoto
    release: September 13, 1985
    
  2. Put gameinfo.yml inside a configmap named nintendo.

  3. Create a PersistentVolume with the following parameters:

    • 2GB storage
    • name: persistentchallenge
    • storage class: manual
    • host path: /mnt/data
  4. Create a PersistentVolumeClaim with the following parameters:

    • 1GB storage
    • name: persistentclaimchallenge
    • storage class: manual
  5. Create a Pod with the following:

  • name the Pod day4challenge
  • give the Pod the label k8s: isawesome
  • Use a nginx image
  • Mount BOTH the PVC persistentclaimchallenge AND configmap nintendo.

The mountPath location is up to you, but the Pod status must be RUNNING to 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