Yaml file script running issue in kubernates

Hello team,

Good afternoon!

Hope you all are doing great.

Please help in finding issue and how to resolve it.
I checked multiple times but did’t find what is misisng or what is the error.

another scrrenshot error after running this file.

Hi @pandit.gaur43
The issue is on the named :

  • matchlabels should be matchLabels
  • replicas should not be inside selector but on same level as selector
  • templates should be template

here is an example :

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: myapp-replicaset
  labels:
    app: myapp
    tier: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      name: myapp
  template:
    metadata:
      labels:
        name: nginx
        labels: myapp
    spec:
      containers:
      - name:  nginx
        image: nginx:latest