@Tej-Singh-Rana @Ayman I am creating a menifests as per the task but still at the end pods are not getting created. I must be missing something in this task. Please Guide. I have created 6 persistant volumes, 1 service and 1 statefulset object which have 6 replicas.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-cluster
spec:
selector:
matchLabels:
app: redis-cluster
serviceName: “redis-cluster-service”
replicas: 6
template:
metadata:
labels:
app: redis-cluster
spec:
containers:
- name: redis-container
image: redis:5.0.1-alpine
command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"]
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- containerPort: 6379
name: client
- containerPort: 16379
name: gossip
volumeMounts:
- name: conf
mountPath: /conf
readOnly: false
- name: data
mountPath: /data
readOnly: false
volumes:
- name: conf
configMap:
name: redis-cluster-configmap
defaultMode: 0755
volumeClaimTemplates:
apiVersion: v1
kind: Service
metadata:
name: redis-cluster-service
labels:
app: redis-cluster
spec:
selector:
app: redis-cluster
ports:
- name: client
protocol: TCP
port: 6379
targetPort: 6379
- name: gossip
protocol: TCP
port: 16379
targetPort: 16379
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis-pv-01
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: “/redis01”
Ayman
May 11, 2021, 12:18pm
#2
Hello @pratikshag
Can you please specify the lab name and question number so that i can help you.
@Ayman This isn’t a lab question. It is one of the devops engineer task.
@Ayman - What the user is asking is after deploying the redis cluster in Challenge #4 - Kubernetes Challenges - KodeKloud
@pratikshag - Here’s what you are looking for -
There’s a button placed to verify whatever resources are created are in good shape or not.
If you are looking for configs needed to complete the challenge, here they are -
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis-cluster
spec:
selector:
matchLabels:
app: redis-cluster # has to match .spec.template.metadata.labels
serviceName: "redis-cluster-service"
replicas: 6 # by default is 1
template:
metadata:
labels:
app: redis-cluster # has to match .spec.selector.matchLabels
spec:
containers:
- name: redis
image: redis:5.0.1-alpine
command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"]
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- containerPort: 6379
name: client
- containerPort: 16379
name: gossip
volumeMounts:
- name: conf
mountPath: /conf
readOnly: false
- name: data
mountPath: /data
readOnly: false
volumes:
- name: conf
configMap:
name: redis-cluster-configmap
defaultMode: 0755
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
apiVersion: v1
kind: Service
metadata:
name: redis-cluster-service
spec:
ports:
- port: 6379
name: client
targetPort: 6379
name: client
- port: 16379
name: gossip
targetPort: 16379
name: gossip
clusterIP: None
selector:
app: redis-cluster
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis01
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis01
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis02
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis02
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis03
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis03
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis04
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis04
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis05
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis05
apiVersion: v1
kind: PersistentVolume
metadata:
name: redis06
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /redis06