Skip to main content

Kubernetes Daily Task Aug 16


Geoff Burke
Forum|alt.badge.img+22

Hey Folks,

 

Missed a day since what I had prepared would not work here it seems because the site won’t allow too big or too many code boxes. Perhaps it is a text to code box size ration thing. I don’t know. Anyways, I will simply have to post it in bits. Create a new namespace

kubectl create ns nginx

Manually create the pvc:

 

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: nginxpvcclaim1
  namespace: nginx
spec:
  storageClassName: csi-hostpath-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

 

 

Today create this deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: nginx
  name: nginx
  namespace: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx
    spec:
      volumes:
        - name: storage
          persistentVolumeClaim:
            claimName: nginxpvcclaim1
      containers:
        - image: nginx
          name: nginx
          ports:
            - containerPort: 80
              name: "http-server"
          volumeMounts:
          - mountPath: "/usr/share/nginx/html"
            name: storage

 

4 comments

Chris.Childerhose
Forum|alt.badge.img+21
  • Veeam Legend, Veeam Vanguard
  • 8521 comments
  • August 16, 2022

Is there commands to go with the last two boxes?  Just wondering or just copy paste?


JMeixner
Forum|alt.badge.img+17
  • On the path to Greatness
  • 2650 comments
  • August 16, 2022

I think the last two code snippets have to go into .yaml files….


Geoff Burke
Forum|alt.badge.img+22
  • Author
  • Veeam Legend, Veeam Vanguard
  • 1318 comments
  • August 16, 2022
JMeixner wrote:

I think the last two code snippets have to go into .yaml files….

that is it.. :) I am trying to make these a bit more fun as I could see myself just copying and pasting so yeah going forward there will be things left out, maybe some errors etc. Should not add much more time but will make it a fun exercise and help with the learning.

 

Here is your and my friend :) I go here once a week at least

 

https://kubernetes.io/docs/reference/kubectl/cheatsheet/


JMeixner
Forum|alt.badge.img+17
  • On the path to Greatness
  • 2650 comments
  • August 16, 2022
Geoff Burke wrote:
JMeixner wrote:

I think the last two code snippets have to go into .yaml files….

that is it.. :) I am trying to make these a bit more fun as I could see myself just copying and pasting so yeah going forward there will be things left out, maybe some errors etc. Should not add much more time but will make it a fun exercise and help with the learning.

 

Here is your and my friend :) I go here once a week at least

 

https://kubernetes.io/docs/reference/kubectl/cheatsheet/

You are testing us heavily… 😎


Comment