Question: 1.) Create Persistent Volumes as mentioned below:
a) Create a first PersistentVolume which should be named redis-pv-01. Configure spec as accessModes which should be ReadWriteOnce, storage capacity should be 1Gi, Type should be hostPath, its hostPath should be /redis01 and directory should be already created on the worker node.
b. Create a second PersistentVolume which should be named redis-pv-02. Configure spec as accessModes which should be ReadWriteOnce, storage capacity should be 1Gi, Type should be hostPath, its hostPath should be /redis02 and directory should already be created on the worker node.
c. Create a third PersistentVolume which should be named redis-pv-03. Configure spec as accessModes which should be ReadWriteOnce, storage capacity should be 1Gi, Type: hostPath, hostPath: /redis03, directory should be already created on the worker node.
d. Creata a fourth PersistentVolume which should be named redis-pv-04. Configure spec as accessModes should be ReadWriteOnce, storage capcity should be 1Gi, Type should be hostPath, its hostPath should be /redis04 and directory should be already created on the worker node.
e. Create a fifth PersistentVolume which should be named as redis-pv-05. Configure spec as accessModes which should be ReadWriteOnce, storage capacity should be 1Gi, Type should be hostPath, its hostPath should be /redis05 and directory should be already created on the worker node.
f. Create a sixth PersistentVolume which should be named redis-pv-06. Configure spec as accessModes which should be ReadWriteOnce, storage capacity should be 1Gi, Type should be hostPath, hostPath should be /redis06 and directory should be already created on the worker node.
2.) We already created ConfigMap named as redis-cluster-configmap. You can try to inspect it.
3.) Create a service which should be named redis-cluster-service. Configure spec as first port name should be client, its port should be 6379 and its targetPort should be 6379. The second port name should be gossip, its port should be 16379 and its targetPort should be 16379, its type should be ClusterIP. And the selector's app should be redis-cluster.
4.) Create a StatefulSet which should be named redis-cluster. Confiugre spec as replicas should be 6, selector's matchLabels app should be redis-cluster. Template's labels app should be redis-cluster under the metadata. The container name should be redis-container, use image redis:5.0.1-alpine ( use exact name of image as mentioned ), use command: ["/conf/update-node.sh", "redis-server", "/conf/redis.conf"], env name should be POD_IP, valueFrom should be fieldRef, fieldPath should be status.podIP (apiVersion: v1). First port name should be client, its containerPort should be 6379, second port name should be gossip, its containerPort should be 16379. First volumeMount name should be conf, its mountPath should be /conf and readOnly should be false ( ConfigMap Mount ), second volumeMount name should be data, its mountPath should be /data, readOnly should be false ( volumeClaim ). Volume name should be conf, its configMap name should be redis-cluster-configmap and its defaultMode should be 0755. volumeClaimTemplates name should be data under metadata, accessModes should be ReadWriteOnce and storage request should be 1Gi.
5.) Configure the Cluster. Once the StatefulSet has been deployed with 6 Running pods, run the following commands and type yes when prompted. Command: kubectl exec -it redis-cluster-0 -- redis-cli --cluster create --cluster-replicas 1 $(kubectl get pods -l app=redis-cluster -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}').
Please Note :- Perform the below commands based on your question server, user name & other details might differ . So please read task carefully before executing. All the Best 👍
Solution:
1. At first kubectl utility configure and working from jump server, run below commands
kubectl get namespace
kubectl get pods
kubectl get pv
2. Create first persistent volumes & then deploy the pods & services
https://gitlab.com/nb-tech-support/devops.git
( Refer Below Video for more clarity )
Happy Learning!!!!
29 Comments
Can you please share the link for the ConfigMap file. I couldn't find it anywhere
ReplyDeleteI have mailed you the configmap , even kept on gitlab. Please have look. Keep learning
Deletetawfikemohamed@yahoo.com
DeleteCan I have it also, yhis is my email: mikezbragais@gmail.com
DeleteI have mailed you please check. Keep Learning
Deletecould you pls explain about config map( /conf/update-node.sh", "redis-server", "/conf/redis.conf)
ReplyDeleteI have kept on gitlab. If you wont able to find then share me your email id, will mail you.
DeleteKeep learning
Hi, I couldn't see the configmap on GitLab, could you please mail the yaml for configmap to me? Many thanks!
ReplyDeleteThanks for approching , I have emailed you . Keep Learning
DeleteI couldn't see the configmap on GitLab, could you please mail the yaml for configmap to me?
ReplyDeleteCan you please share the link for the ConfigMap file. I couldn't find it anywhere
ReplyDeleteCan you please share the config map
ReplyDeleteSure will share . Please share your email id or check mine git repo
DeleteI couldn't see the configmap on GitLab, could you share the link for that?
ReplyDeleteCan you please share the link for config map in git repo?
ReplyDeleteI have kept on gitlab. If you wont able to find then share me your email id, will mail you.
DeleteKeep learning
ReplyDeleteCan you please share the link for config map in git repo?
namle1254@gmail.com
Thanks for approaching. I have email you config map , please check
Deletesorry, my mail is namle1264@gmail.com
DeleteCan you please share the link for config map in git repo?
ReplyDeletesaiatainas@gmail.com
Have emailed you. please check. Keep Learning
DeleteCan you please share the link for config map in git repo?
ReplyDeletemanifest998@gmail.com
Have emailed you . Please check
Deletecan u pls share configmap? akshay10101053@gmail.com
ReplyDeletePlease check I have emailed you
Deletecan you provide me the config file i couldnt find it? my email is this:
ReplyDelete1praveenbhawantha@gmail.com
can you provide me the config file,my mail id is venkatp.rel@gmail.com
ReplyDeletesure. Please check your email.
DeleteCan you please mail me the configmap on this atharvanhsm@gmail.com
ReplyDelete