Kodekloud Challenge #1 issue with creating the pod - issue with command

Thanks @Carim-Manzur for the explaination!

I changed commands in init container to clear /site before starting jekyll and it did the trick.
Here is that part of manifest-

initContainers:
- image: kodekloud/jekyll
name: copy-jekyll-site
command: [“/bin/sh”, “-c”]
args: [“rm -Rf /site; jekyll new /site”]
volumeMounts:
- mountPath: /site
name: site

1 Like

I love all the it works on my box snarky answers

1 Like

this is all still happening. Finished the challenge with 20 mins to spare, spend the next 20 mins trying to troubleshoot why my pod wont come up (so essentially failed the challenge, because of the above). Before "complete the challenge according to the instructions or GH reference), i even compared mine to GH, no diff. Replaced the pod same result., replaced the po defination with GH po def and replaced the po. Same result.

So in short. Still happening. Please fix. This is causing more anxiety than it should…Thank you

Also this is the 3rd week in a row for the same thing. Please fix

For reference, let’s look quickly at the diagram:

The lab works, so it makes most sense to figure out why the pod does not “come up”. The most likely cause, judging by the dependencies, is that your PVC is not binding correctly. You haven’t mentioned if you’ve tried to look for events in the development namespace – this is where you can check for errors related to binding the PVC to the PV, and if there’s a problem using the PVC in the pod. Since you’re not using a deployment here, this suggests that there was an error loading its YAML. So what did you see?

Another possibility is that the initContainer defined for the pod is not executing right. What did you check there?

I’m still having issues with this lab, it’s always the initContainer: ‘copy-jekyll-site’, command: [ “jekyll”, “new”, “/site” ] (command to run: jekyll new /site) instruction.
I’ve done it my way and also followed github instructions, it doesn’t matter, always failing. And the problem about gems persist.

I assume you’ve looked at the solution in the github repo. What does k describe pod say for the jeckly pod?

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
ffi-1.17.0-x86_64-linux-musl requires rubygems version >= 3.3.22, which is
incompatible with the current version, 3.0.3

For -c jekyll

There is a ticket for engineering team to update that challenge with latest versions of Jekyll and ensure the containers start correctly. When it will be done, I have no indication.

2 Likes

I reported the same for init container

k logs -n development jekyll -c copy-jekyll-site
Running bundle install in /site... 
  Bundler: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
  Bundler: Fetching gem metadata from https://rubygems.org/............
  Bundler: Fetching gem metadata from https://rubygems.org/.
  Bundler: Resolving dependencies...
  Bundler: ffi-1.17.0-x86_64-linux-musl requires rubygems version >= 3.3.22, which is
  Bundler: incompatible with the current version, 3.0.3

k logs -n development jekyll -c copy-jekyll-site:

/usr/local/lib/ruby/site_ruby/2.5.0/bundler/resolver.rb:287:in block in verify_gemfile_dependencies_are_found!': Could not find gem 'minima (~> 2.0)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound) from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/resolver.rb:255:in each’
from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/resolver.rb:255:in verify_gemfile_dependencies_are_found!' from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/resolver.rb:49:in start’
from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/resolver.rb:22:in resolve' from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:258:in resolve’
from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:170:in specs' from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:237:in specs_for’
from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:226:in requested_specs' from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:108:in block in definition_method’
from /usr/local/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:20:in setup' from /usr/local/lib/ruby/site_ruby/2.5.0/bundler.rb:107:in setup’
from /usr/local/bundle/gems/jekyll-3.8.5/lib/jekyll/plugin_manager.rb:50:in require_from_bundler' from /usr/local/bundle/gems/jekyll-3.8.5/exe/jekyll:11:in <top (required)>’
from /usr/local/bundle/bin/jekyll:23:in load' from /usr/local/bundle/bin/jekyll:23:in

Defaulted container “jekyll” out of: jekyll, copy-jekyll-site (init)
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java.
Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies…
ffi-1.17.0-x86_64-linux-musl requires rubygems version >= 3.3.22, which is
incompatible with the current version, 3.0.3

Absolutely @Carim-Manzur - this was exactly the problem. I don’t know what caused the initContainer to crash, but it could not start again.
I deleted the files in /site manually on the node01 to which i got using ssh node01.
Init container started normally.

Hi everyone, I figured out the cause of the error, if you are just copying and pasting the command it will include spaces and messed up apostrophes characters into the command.

You could simply type it yourself or remove the spaces between the characters and fix the apostrophe. Another way to do it would be by using the --command during the pod provisioning like this:

kubectl run pod --image image.url --comand --dry-run=client -o yaml – jekyll new /site

This in my opinion will be the easiest way to do it, the syntax in the yaml is cleaner:


command:

  • jekyll
  • new
  • /site

The issue is the git lab code. if you directly copypaste or clone the gitlab , then that code will give issue of command run and init container not running.
After multiple tries , finally create a dummy pod using --dry-run=client and saving it to yaml file.

k run pod --image gcr.io/kodekloud/customimage/jekyll-serve -l run=jekyll -n development --dry-run=client -o yaml > jekyll_pod.yaml

after that editing the file to add line by line all stuff.
make sure you type everything and use proper indentation.
after completing file, you will notice no change from gitlab file but still this will not give error coz we typed and not copy pasted.

vi jekyll_pod.yaml
rm -rf /site

controlplane ~ ➜ cat jekyll_pod.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: jekyll
name: jekyll
namespace: development
spec:
containers:

controlplane ~ ➜

controlplane ~ ➜ k create -f jekyll_pod.yaml
pod/jekyll created

controlplane ~ ➜ k get pods -n development jekyll --watch
NAME READY STATUS RESTARTS AGE
jekyll 0/1 Init:0/1 0 17s
jekyll 0/1 Init:0/1 0 18s
jekyll 0/1 PodInitializing 0 110s
jekyll 1/1 Running 0 111s
^C
controlplane ~ :heavy_multiplication_x: k get pod
NAME READY STATUS RESTARTS AGE
jekyll 1/1 Running 0 2m49s

Hi @Rahoaxn
Which code are you referring to? If it is one of our github repos, please indicate which line(s) the errors are and we will fix it.

And when posting YAML, please paste it in a code block. The formatting above will not help anyone.

apiVersion: v1
kind: Pod
metadata:
  labels:
    run: jekyll
    name: jekyll
    namespace: development
spec:

image

Hello,

The yaml given in the

link is giving issue if the code is directly copy pasted from the link.

Even i got the same error everytime i copy pasted the complete code from the above github link.

but when i created a dummy pod yaml with below command

k run pod --image gcr.io/kodekloud/customimage/jekyll-serve -l run=jekyll -n development --dry-run=client -o yaml > jekyll_pod.yaml

and edited the yaml file to include everything from that github code link by typing each and every word of the code (no copy paste), then i did not get that error .

controlplane ~ ➜  cat jekyll_pod.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: jekyll
  name: jekyll
  namespace: development
spec:
  containers:
  - image: gcr.io/kodekloud/customimage/jekyll-serve
    name: jekyll
    volumeMounts:
    - mountPath: /site
      name: site
  initContainers: 
  - name: copy-jekyll-site
    image: gcr.io/kodekloud/customimage/jekyll
    command: [ "jekyll" , "new" , "/site" ]
    volumeMounts:
    - mountPath: /site
      name: site
  volumes:
  - name: site
    persistentVolumeClaim:
      claimName: jekyll-site

controlplane ~ ➜  k create -f jekyll_pod.yaml 
pod/jekyll created

controlplane ~ ➜   k get pods -n development jekyll --watch
NAME     READY   STATUS     RESTARTS   AGE
jekyll   0/1     Init:0/1   0          17s
jekyll   0/1     Init:0/1   0          18s
jekyll   0/1     PodInitializing   0          110s
jekyll   1/1     Running           0          111s
^C
controlplane ~ ✖ k get pod
NAME     READY   STATUS    RESTARTS   AGE
jekyll   1/1     Running   0          2m49s