Kubernetes Redis Deployment-need help

Hi @andrzej @player001
I am new to Kubernetes and i got this task please provide some guidance on how to proceed this . While running
kubectl create configmap redis-config command I am getting following error

The connection to the server localhost:8080 was refused - did you specify the right host or port? task_issue

Hello, roopal.mishra
First of all you have to try from thor user not from root user. Because k8s cluster access credentials stored in thor home directory in .kube directory. give it a try.

Hi @player001 ,
Thanks for your quick reply i tried ,i am able to create configmap but after running
kubectl apply -f redis-deployment.yml

Hello, roopal.mishra
You need to correct some fields.

  1. You are creating Pod and question is for Deployment.
  2. You need to add label in the pod.metadata section.
  3. You need to add “requests” instead of “limits”.
  4. You can create config in two way declarative or imperative way.
kind: ConfigMap
apiVersion: v1
  name: redis-config
  maxmemory: 2mb

You can add all in single manifest file.
start with three hyphen dots.

kind: ConfigMap

kind: Deployment

Hi ,
I am not able to add path to emptydir and A configmap volume it is giving error but when i removed path deployment created but it is not in running state. Please guide me what I am doing wrong.
Thanks In Advance

Actually we don’t define path for the emptyDir because of nonpersistent behaviour. Remove the path from there.
We cannot define labels under the containers section remove from there. We only write labels under metadata section.
After deployment up and running, You can verify by: –
kubectl describe deployment redis-deployment

Hi ,
In task statement it is mentioned to create empty dir at /redis-master-data ,without path i tried to run
kubectl apply -f redis-deployment.yml
deployment get created but it is not runningproblem_statement

Actually emptyDir don’t need path, it will occupy path from mountPath so don’t worry for that.
Is it scheduled on master node?
kubectl get pod -owide ???
Did you create configmap?


I think you have to deploy this configmap yaml file. Instead of putting whole config.
kubectl create -f redis-config.yml --> declarative way
kubectl create configmap redis-config --from-literal=maxmemory=2mb --> imperative way

I am not getting what you want to say. Please explain

Now you are getting?

first i made redis-config.yml file mention all detail in it then
kubectl create configmap redis-config --from-file=/redis-config.yml

You don’t need to export whole data in it.

rather then do kubectl create -f redis-config.yml
You have to add data not whole config file
and as we knew data is “maxmemory=2mb”.

Can you describe the events of the pod why it’s not running?
kubectl describe pod pod-name

Pod should be schedule on master node but i can see it’s trying to schedule on node01 ? as per question.

how to schedule it on masternode??

Whatever i said apply it, it will be up and run but schedule this pod on master not in node01