Welcome to the Linux Foundation Forum!

Lab 6.1 Step 2: No Resources Found

mabricker
mabricker Posts: 6
edited October 2022 in LFS258 Class Forum

After typing the command under step 2: kubectl get secrets --all-namespaces, I have "No resources found" returned. Is there some underlying detail I missed along the way?

FYI, /var/run/secrets does not exist

Best Answer

  • chrispokorni
    chrispokorni Posts: 1,759
    Answer ✓

    Hi @mabricker,

    In latest releases, Kubernetes no longer creates token secrets automatically. It becomes the user's responsibility to create them as desired. The following commands should work instead:

    export token=$(kubectl create token default)

    curl https://k8scp:6443/apis --header "Authorization: Bearer $token" -k

    Regards,
    -Chris

Answers

  • Napsty
    Napsty Posts: 10

    Had the same question as @mabricker . Thanks @chrispokorni for explaining why the default tokens are not created (anymore). :) The Course material should be updated accordingly.

  • I also ran into the same issue. Glad to see it answered here. Thanks @chrispokorni

  • Should the above commands create resources that should be viewable using the kubectl get secrets command? Because it does not create any secrets according to my installation.

  • Hi @dont827273,

    The kubectl create token ... command above creates a token, not a secret.

    You can read more at https://kubernetes.io/docs/concepts/configuration/secret/

    Regards,
    -Chris

  • kmai007
    kmai007 Posts: 4
    edited February 28

    its 2/28/2023 and I've ran into this exact issue with this lab material. SO basically your suggestion is to create it and disregard steps 1-3.

  • dicalleson
    dicalleson Posts: 17

    Same issue here. @chrispokorni Do we create secrets or just skip these steps?

  • fazlur.khan
    fazlur.khan Posts: 15

    Hello @kmai007

    In the updated lab (2/28/2023) we have added the step 6.2 which generates the token

    export token=$(kubectl create token default)

    Please verify.

    thanks,
    Fazlur

  • dicalleson
    dicalleson Posts: 17

    Summary of issue and proposed answer and correction to lab document:
    The Problem:
    For Lab 6.1 - Step 1 -3
    With k8s Version 1.25.1 you will get the following
    $ kubectl get secrets --all-namespaces
    No resources found
    $ kubectl get secrets
    No resources found in default namespace.

    Solution: Skip steps 1-4 and instead run
    $ export token=$(kubectl create token default)
    Then as in step 5 run:
    $ curl https://k8scp:6443/apis --header "Authorization: Bearer $token" -k

  • fazlur.khan
    fazlur.khan Posts: 15

    @dicalleson

    We have fixed this in the V1.26.1 version of Lab. Thank you.

    regards,
    Fazlur

Categories

Upcoming Training