Welcome to the Linux Foundation Forum!

LFS258 - Install Kubernetes Lab 3.4 -- Deploy Web app

Serious Question why use this command
kubectl get deployments nginx --export -o yaml

when you KNOW its going to spit out a ton of garbage that you are going to have to edit.

One quick google search and I landed over at the Kubernetes docs page and they provided something that looks a WHOLE lot familiar.

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Writing up your own yaml is more up a developer workflow and is the same approach Nigel Poulton uses in his book and his acloudguru class "Kubernetes Deep Dive"

I pretty much threw up my hands in frustration trying to follow the tiny lab text and the instructions that are all over with poor examples of end states and just wrote up a nginx.yaml file that
a) I can read
b) is minimalistic
c) Other people can read

I just want to know the WHY.

Comments

  • serewicz
    serewicz Posts: 1,000

    Hello,

    Thank you for your thoughtful response. I will make sure it gets all the attention it deserves.

    Regards,

Categories

Upcoming Training