Hey, lightning lab 1 question 6, I believe I am doing everything right but could . . .

Apaar Sharma:
hey, lightning lab 1 question 6, I believe I am doing everything right but couldn’t quite find out what i am doing wrong, can somebody look at my yml file and correct me.

Apaar Sharma:
controlplane $ k describe po redis-64b968cfd6-g6vpp
Name: redis-64b968cfd6-g6vpp
Namespace: default
Priority: 0
Node: controlplane/172.17.0.14
Start Time: Wed, 05 May 2021 19:49:46 +0000
Labels: app=redis
pod-template-hash=64b968cfd6
Annotations: <none>
Status: Running
IP: 10.44.0.2
IPs:
IP: 10.44.0.2
Controlled By: ReplicaSet/redis-64b968cfd6
Containers:
redis:
Container ID: docker://6282944331bb514a537ec830cfdcbac77ec31162556ba26ead092bfb93a5ebb4
Image: redis:alpine
Image ID: docker-pullable://redis@sha256:f8f0e809a4281714c33edf86f6da6cc2d4058c8549e44d8c83303c28b3123072
Port: 6379/TCP
Host Port: 0/TCP
State: Running
Started: Wed, 05 May 2021 19:49:47 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/redis-master from redis-config (rw)
/redis-master-data from data (rw)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-h7sx2 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
data:
Type: EmptyDir (a temporary directory that shares a pod’s lifetime)
Medium:
SizeLimit: <unset>
redis-config:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: redis-config
Optional: false
default-token-h7sx2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-h7sx2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message


Normal Pulled 9m37s kubelet, controlplane Container image “redis:alpine” already present on machine
Normal Created 9m37s kubelet, controlplane Created container redis
Normal Started 9m37s kubelet, controlplane Started container redis

Mohamed Ayman:
Can you please delete the deployment and try again with this yaml file

apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: redis
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: redis
spec:
nodeName: master
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: redis-config
containers:
- image: redis:alpine
name: redis
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
ports:
- containerPort: 6379
resources:
requests:
cpu: “0.2”

Mohamed Ayman:
Since you have to change the nodename to master as required in the question

Rahul:
you need to remove “resources” as you have used it twice

Rahul:
empty resources might override the actual onces

Apaar Sharma:
@Mohamed Ayman the pod doesn’t get scheduled at all with this yaml as there is no pod called master
image.png

Rahul:
@Apaar Sharma Just tried with nodeName: controlplane and it works

Apaar Sharma:
@Rahul you passed the task ? Can you please send your yaml ?

Rahul:
yes, I used @Mohamed Ayman’s yaml and updated the name

Rahul:
try it once

Rahul:
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: redis
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: redis
spec:
nodeName: controlplane
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: redis-config
containers:
- image: redis:alpine
name: redis
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
ports:
- containerPort: 6379
resources:
requests:
cpu: “0.2”