Environment Variables in Kubernetes

@rahul456 @mmumshad , HI I feel there are couple of issues with below line:
echo -en ‘/n’

this is how its getting printed:
kubectl logs envars-fieldref -n fieldref-namespace
-en /n
node01
envars-fieldref
fieldref-namespace
10.44.0.1
default

As you can see, getting “-en /n” string in the output

If I just keep echo ‘\n’; in the args, we get correct new line character in the output:

thor@jump_host ~$ kubectl logs envars-fieldref -n fieldref-namespace

node01
envars-fieldref
fieldref-namespace
10.44.0.1
default

node01
envars-fieldref
fieldref-namespace
10.44.0.1
default

hi @salilpune1, did it fail for you ?

@Inderpreet and @rahul456
My task failed can you please check why it faild. Thank you

@nashwan, can you please share your pod template ?

@rahul456 actually I think I know the problem I think the question asked me about redis image if I am not wrong. unfortunately haven’t captured screen the question and the pod template from what I submitted. would still appreciate if you can check and verify? thank you heaps!

@nashwan, this is marked pending for you, please give it an another try.

@rahul456 thank you very much, really appreciate your support.

Nope… It worked. Thanks.

Can anyone please check below task. It was completed but still show failed.

Environment Variables in Kubernetes

hi @nithyaks, as per question, your image should be ‘httpd’ instead of ‘redis’

@rahul456

When i tried first time it show image as redis. So I tried with same image. Kindly let me know whether i can get one more chance.

Hi @rahul456 @Inderpreet @kodekloud-support3

my task was print Print Environment Variables
before pressing finish button i have to know where its went wrong
my pod template is

apiVersion: v1
kind: Pod
metadata:
name: print-envars-greeting
spec:
containers:

  • name: print-env-container
    image: bash
    env:
    • name: GREETING
      value: “Welcome to”
    • name: COMPANY
      value: “Dev0ps”
    • name: GROUP
      value: “Industries”
      command: [“echo”]
      args: [“$(GREETING) $(COMPANY) $(GROUP)”]

after creating pod , i am getting pod status as CrashLoopBackOff , where i had done wrong in pd template, please check my pod template and tell me the issue where i had done wrong before pressing finish button, i am waiting for replay

Hello, @jayaram.taragala
You missed $ sign for rest 2 variables.

Thanks #player001 , I missed the $ sign , after giving $ sign to environmental variables also I am getting same issue, can please check it, and rectify my issue

Can you share the error output ? Define ${GREETING} like.

player001 rahul456
nithyaks salilpune1

My Task failed. But i think is correct. Please Advise
image

@chawki, sorry for the issue, this is marked pending for you, please give it an another try.

Thanks for your prompt response.

I give it another try. It’s failed again but now because i misspelled the Word Devops instaed of “DevOps”