I'm quite new to kubernetes, and I'm trying to deploy a docker container to kubernetes. I already have a docker container running on AWS. I am trying to deploy the yml file through the following command:
kops create -f deployment.yml --state=s3://mybucketHowever whenever I try to deploy my yml file, I get a message saying:
error parsing file "deployment.yml": no kind "Cluster" is registered for version "v1"My yml file looks like this:
apiVersion: v1
kind: Cluster
metadata:
name: containers
spec:
containers:
- name: container
image: [idnumber].dkr.ecr.eu-west-2.amazonaws.com/myfirstcontainer
ports:
- containerPort: 3000Grateful for any help!
Thanks
There is no kind: Cluster in kubernetes API v1.
You should use kind: Pod if you want to run only one pod or use deployment, if you want to create controller which manages your pod:
apiVersion: apps/v1beta2 # for versions before 1.8.0 use apps/v1beta1
kind: DeploymentAlso, you have some issues with formatting in your deployment.yml file.
The final deployment.yml should be for pod:
apiVersion: v1
kind: Pod
metadata:
name: containers
spec:
containers:
- name: container
image: [idnumber].dkr.ecr.eu-west-2.amazonaws.com/myfirstcontainer
ports:
- containerPort: 3000or for deployment:
apiVersion: apps/v1beta1 # for versions starting from 1.8.0 use apps/v1beta2
kind: Deployment
metadata:
name: containers
spec:
replicas: 1
selector:
matchLabels:
app: some_app
template:
metadata:
labels:
app: some_app
spec:
containers:
- name: container
image: [idnumber].dkr.ecr.eu-west-2.amazonaws.com/myfirstcontainer
ports:
- containerPort: 3000