gopichand
gopichand

Reputation: 1

mapping values are not allowed in this context while deploying

getting error as mapping values are notallowed in this context

I have written a deployment manifest file and getting an error message.as mappling values are not allowed. apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: replicas: 3 selector: matchlabels: app: my-app template: metadata: labels:my-appp spec: containers: - image: nginx name: my-ngnix ports: - containerPort: 8080

Upvotes: 0

Views: 233

Answers (1)

Arko
Arko

Reputation: 3781

The YAML syntax in your deployment manifest is incorrect. YAML is very sensitive to indentation and requires specific formatting to correctly express the nested structure of the configuration.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-nginx
          image: nginx
          ports:
            - containerPort: 8080

Apply the same using kubectl apply -f <filename.yaml>

enter image description here

enter image description here

Upvotes: 0

Related Questions