0

I know that yml files are temperamental and I still struggle to figure it out. Can anyone help out here to understand what is it about my client-deployment.yml file that makes Kubernetes want to issue the above error?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      component: web
  template:
    metadata:
      labels:
        component: web
    spec:
      containers:
        - name: client
          image: ldco2016/multi-client:v1.2
          ports:
            - containerPort: 3000

I got the above error running kubectl apply -f k8s

k8s being one of the folders in the project with the yml configuration files.

0

Sure enough, everything and including the last spec: needed to be tabbed to the left once:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      component: web
  template:
    metadata:
      labels:
        component: web
    spec:
      containers:
        - name: client
          image: ldco2016/multi-client
          ports:
            - containerPort: 3000

Unfortunately, you can't tell the difference with how yaml is formatted when pasted here, so it would not have been an easy catch, but if you would be looking at the original file configuration you would have noticed it like I did when I looked a third time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.