I'm using docker desktop with kubernetes and I'm trying to create some pods but I've noticed a syntax error in the yaml file can anyone tell me where I'm going wrong or if there's any extra configuration before creating the pods
follow my file: 01-nestjs.yaml
apiVersion: v1
kind: Pod
metadata:
name: api-gateway
subsets:
- addresses:
- ip: 192.168.18.8
ports:
- port: 3000
spec:
containers:
name: api-gateway
image: nestjs/cli:latest
env:
name: NODE_ENV
value: "production"
imagePullPolicy: Always
serviceAccountName: default
meu error:
error: error parsing ./01-nestjs.yaml: error converting YAML to JSON: yaml: line 13: mapping values are not allowed in this context
CodePudding user response:
What's the overall objective with the usage of "Endpoints" in your scenario? The apiversion for your Endpoints.Subsets field doesn't have a specs field associated with it, so I'm not 100% sure on the right way to answer this, unless I'm misunderstanding your code.
CodePudding user response:
Your YAML definition looks like a mix of Endpoint
and Pod
which can not work. I suggest you to check Kubernetes documentation for basic examples from which you can derive and experiment.
Try with this example:
apiVersion: v1
kind: Pod
metadata:
name: api-gateway
spec:
serviceAccountName: default
containers:
- name: api-gateway
image: nestjs/cli:latest
imagePullPolicy: Always
env:
- name: NODE_ENV
value: "production"