Initcontainer command in kubernetes challange 1 is erring out

No matter how I write the initContainer command in Kubernetes challange 1, I see the task as incomplete.

Here is my POD configuration.

apiVersion: v1
kind: Pod
metadata:
name: jekyll
labels:
run: jekyll
spec:
initContainers:

  • name: copy-jekyll-site
    image: kodekloud/jekyll
    command: [‘sh’, ‘-c’, “jekyll new /site”]
    volumeMounts:
    • name: site
      mountPath: /site
      containers:
  • name: jekyll
    image: kodekloud/jekyll-serve
    volumeMounts:
    • name: site
      mountPath: /site
      volumes:
    • name: site
      persistentVolumeClaim:
      claimName: jekyll-site

I tried with command: [ “jekyll”, “new”, “/site”]. That too was not accepted. Where am I going wrong?

Hi @venumadhav.hari
You add container information inside initContainers base on the YAML file you provide. The right syntax should be :

apiVersion: v1
kind: Pod
metadata:
  namespace: development
  name: jekyll
  labels:
    run: jekyll
spec: 
  containers:
  - name: jekyll
    image: kodekloud/jekyll-serve
    volumeMounts:
    - mountPath: /site
      name: site  
  initContainers:
  - name: copy-jekyll-site
    image: kodekloud/jekyll
    command: [ "jekyll", "new", "/site" ]
    volumeMounts:
    - mountPath: /site
      name: site
  volumes:
  - name: site
    persistentVolumeClaim:
      claimName: jekyll-site

You need to create a block container

Regard

Hi @mmkmou_KodeKloud,
Thanks for the reply.
The error in my Yaml was a copy paste indentation error.

However, I have tried the same exact way that you have mentioned in your yaml. But still I got the same error.

Thanks,
Venu

Hi @venumadhav.hari,
Can you please provide us the copy - paste of your error?