In a class and working on a kubernetes portion. I copied her json file by hand as it was in a video where we were asked to copy it from her screen. I ran the file through a yml validator and it said it was valid yet I get an error when running the apply command in terminal.
the .yml file is as follows:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: 'nginx:1.14.2'
ports:
- 'containerPort:80'
when running kubectl apply -f nginx-deployment I get the following error:
Error from server (BadRequest): error when creating "nginx-deployment.yml": Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal string into Go struct field Container.spec.template.spec.containers.ports of type v1.ContainerPort
It's telling you that this portion:
is a string and its expecting an integer. You cannot have
'containerport'here. You could have80as an integer. But not a string.