Question : Deploy the given architecture to vote namespace
1. Create a service: name = vote-service
port = '5000'
targetPort = '80'
nodePort= '31000'
service endpoint exposes deployment 'vote-deployment'
2. Create a deployment: name = 'vote-deployment'
image = 'kodekloud/examplevotingapp_vote:before'
status: 'Running'
3. New Service, name = 'redis'
port: '6379'
targetPort: '6379'
type: 'ClusterIP'
service endpoint exposes deployment 'redis-deployment'
4. Create new deployment, name: 'redis-deployment'
image: 'redis:alpine'
Volume Type: 'EmptyDir'
Volume Name: 'redis-data'
mountPath: '/data'
status: 'Running'
5. Create new deployment. name: 'worker'
image: 'kodekloud/examplevotingapp_worker'
status: 'Running'
Solution:
1. Create new Namespace vote & validate the status
root@controlplane
~ ➜ kubectl
create namespace vote namespace/vote
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
get namespace NAME STATUS AGE default Active 36m kube-node-lease Active
36m kube-public Active 36m kube-system Active 36m vote Active 2s root@controlplane
~ ➜ |
git clone https://gitlab.com/nb-tech-support/devops.git
( Refer Below Video for more clarity )
3. Create new db-deployment & validate the status
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/db-deployment.yml deployment.apps/db-deployment
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
get deployment -n vote NAME READY UP-TO-DATE AVAILABLE
AGE db-deployment 1/1
1 1 27s root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/db-service.yml service/db
created root@controlplane
~ ➜ kubectl
get svc -n vote NAME TYPE
CLUSTER-IP
EXTERNAL-IP PORT(S) AGE db ClusterIP 10.108.140.177 <none> 5432/TCP 11s root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/redis-deployment.yml deployment.apps/redis-deployment
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/redis-service.yml service/redis
created root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/worker.yml deployment.apps/worker
created root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/result-deployment.yml deployment.apps/result-deployment
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/result-service.yml service/result-service
created root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/vote-deployment.yml deployment.apps/vote-deployment
created root@controlplane
~ ➜ root@controlplane
~ ➜ kubectl
apply -f devops/kubernetes-challenges/challenge-3/vote-service.yml service/vote-service
created root@controlplane
~ ➜ |
root@controlplane
~ ➜ kubectl
get all -n vote NAME
READY STATUS RESTARTS
AGE pod/db-deployment-7f94c7d956-9nh69 1/1
Running 0 12m pod/redis-deployment-69957f749-5fcs6 1/1
Running 0 3m3s pod/result-deployment-6b49cd76bc-6fjgz 1/1
Running 0 2m39s pod/vote-deployment-8d7f7bcdc-p8w7z 1/1
Running 0 2m22s pod/worker-64d7c4db94-f842s 1/1 Running
0 2m46s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/db ClusterIP 10.108.140.177 <none> 5432/TCP 10m service/redis ClusterIP 10.110.206.89 <none> 6379/TCP 2m57s service/result-service NodePort
10.106.219.112
<none>
5001:31001/TCP 2m30s service/vote-service NodePort 10.111.78.1 <none> 5000:31000/TCP 2m11s NAME READY UP-TO-DATE AVAILABLE
AGE deployment.apps/db-deployment 1/1
1 1 12m deployment.apps/redis-deployment 1/1
1 1 3m4s deployment.apps/result-deployment 1/1
1 1 2m40s deployment.apps/vote-deployment 1/1
1 1 2m22s deployment.apps/worker 1/1 1 1 2m46s NAME
DESIRED CURRENT READY
AGE replicaset.apps/db-deployment-7f94c7d956 1 1 1 12m replicaset.apps/redis-deployment-69957f749 1
1 1 3m3s replicaset.apps/result-deployment-6b49cd76bc 1
1 1 2m40s replicaset.apps/vote-deployment-8d7f7bcdc 1 1 1 2m22s replicaset.apps/worker-64d7c4db94 1 1 1 2m46s |
10. Click on Check & Confirm to complete the task successfully
Happy Learning!!!!
0 Comments