Kubernetes environment variable

I did everything correct, just given wrong container name, please reassign to me.

apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: envars-fieldref
name: envars-fieldref
namespace: fieldref-namespace
spec:
containers:

  • image: httpd:latest
    name: envars-fieldref
    command: [“sh”,“-c”,“while true; do echo -en ‘/n’; printenv NODE_NAME POD_NAM POD_NAMESPACE; printenv POD_IP POD_SERVICE_ACCOUNT; sleep 10; done;”]
    env:
    - name: NODE_NAME
    valueFrom:
    fieldRef:
    fieldPath: spec.nodeName
    - name: POD_NAME
    valueFrom:
    fieldRef:
    fieldPath: metadata.name
    - name: POD_NAMESPACE
    valueFrom:
    fieldRef:
    fieldPath: metadata.namespace
    - name: POD_IP
    valueFrom:
    fieldRef:
    fieldPath: status.podIP
    - name: POD_SERVICE_ACCOUNT
    valueFrom:
    fieldRef:
    fieldPath: spec.serviceAccountName
    restartPolicy: Never

hi @smohdiqbal, as per question, container name should be feildref-container instead of envars-fieldref.

You should stick to the question. Please put the task in review to get another chance to attempt.

@rahul456, yes i know i made this mistake, review should be done for the question where we dont know something. this way i will loose marks , other person will get marks without doing anything.

I request you to assign back to me .
thanks

the task will expire, please reply soon

@smohdiqbal, marked pending for you, please give it an another try,

And, please be stick to the question for the future tasks.

ok for sure,
thanks,

Hi @rahul456 I had “Environment Variables in Kubernetes” under review … and I found it as expired today… Can you help me with that ? I was waiting for the review cause I thought I did all good…Thanks


Hi @alpiz, as per question you were not asked to create any namespace. You created a pod under namespace thats the reason your task got failed.

Thanks for the help @rahul456 … But can I try again ? I did not have the chance, thanks for your help

@alpiz, you will be re-assigned failed/expired tasks in near future.

1 Like