I am running my docker image in my local machine (executing my performance test based on the arguments provided) with the following command like this
whereas, satheeshpandianj/my-perf-app is my image name and rest (QA Commerce ListMarkets 1 5 Volvo) are arguments passed to this image to run. I have already pushed this image to docker hub. I want to run this docker image in kubernetes. I wrote the deployment yaml file like below.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: perf
name: perf
spec:
replicas: 1
selector:
matchLabels:
app: perf
template:
metadata:
labels:
app: perf
spec:
containers:
image: docker.io/satheeshpandianj/my-perf-app
name: perf
args: ["QA", "Commerce", ListMarkets", 1, 5, "Volvo"]
When I am executing "kubectl apply -f perf.yaml", I am getting a below error
Can someone help me to resolve this error? Or please correct me what changes need to be made in my yaml file. Thanks in advance.
CodePudding user response:
You are getting this error because the spec.containers, expects a list. You have to update your yaml to this:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: perf
name: perf
spec:
replicas: 1
selector:
matchLabels:
app: perf
template:
metadata:
labels:
app: perf
spec:
containers:
- image: docker.io/satheeshpandianj/my-perf-app
name: perf
args: ["QA", "Commerce", ListMarkets", 1, 5, "Volvo"]
Yes, only the -
is missing