Answer or sh script for task: "Deploy Node App on Kubernetes"

Do you have the sh script or documentation (basically the answer/s) for this task, for students to know where they might be going wrong for learning purposes?

Hello @simfonika,

Which training course/lab that you currently working on?
Can you share the link to this course/lab so we can support?

Thanks,
Trung.

It is one of the Tasks on the kodekloud-engineer.com site.

e.g.

Hello @simfonika,

In the case of KKE, imagine that you’re working for a fictional company and each task here is a kind of task on your real project, after completing it, you can earn some points, and when you get enough points, you will be promoted to the next level, hence we not providing hint or solutions like normal labs.
You can discuss with other KKE members in the slack channel, googling for the solution if you have no idea how to solve it (just like what you do in the real project).

Thanks,
Trung.

Hi, can you confirm if the commands and file below is the correct answer/s?

kubectl get namespace
kubectl create namespace node-namespace-nautilus
kubectl get namespace
kubectl get deploy
kubectl get deploy -n node-container-nautilus
vi /tmp/node.yaml
(Create a YAML  file with all the parameters, you can copy from GitLab
    https://gitlab.com/nb-tech-support/devops.git)
	
apiVersion: v1
kind: Service
metadata:
  name: node-service-nautilus
  namespace: node-namespace-nautilus
spec:
  type: NodePort
  selector:
    app: node-app-nautilus
  ports:
    - port: 80
      targetPort: 8080
      nodePort: 30012
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-deployment-nautilus
  namespace: node-namespace-nautilus
spec:
  replicas: 2
  selector:
    matchLabels:
      app: node-app-nautilus
  template:
    metadata:
      labels:
        app: node-app-nautilus
    spec:
      containers:
        - name: node-container-nautilus
          image: gcr.io/kodekloud/centos-ssh-enabled:node
          ports:
            - containerPort: 80
 
 
4.  Run the below command to create a pod

    kubectl create -f /tmp/node.yaml



5.  Wait for  deployment & pods to get running status
        kubectl get deploy -n node-namespace-nautilus

        kubectl get pods -n node-namespace-nautilus

output from task:
image

Hello @Tej-Singh-Rana

Can you assign me this KKE task so that I can check and support this case?

Thanks,
Trung.

Hi @trung-kodekloud,
I assigned you this task. Please check it.

Regards,

Hi @simfonika,
Have you got a chance to share your work under the “Review” section?

Regards,

Thanks, working on it!

Trung.

Hi @Tej-Singh-Rana, I have now clicked on Request Review button.

Hi @simfonika,
I checked your work and you were creating resources in node-namespace-nautilus namespace which didn’t ask in the task.
Please create in the default namespace.

Regards,

That’s why validation was looking for the resources under the default namespace and didn’t find anything hense you can see the error message “is not”.

Hello @simfonika,

Please follow @Tej-Singh-Rana solutions, it is supposed to be the namespace issue, if you are still not able to solve it, let me know, and I will support you.

Thanks,
Trung.

Hi, thank you @Tej-Singh-Rana, is it possible for the task to become available again for one to re-try?

Hi @simfonika,
Yes, it is possible.
I think you are not familiar with the “Review” feature. Please have a look.

Regards,

Whoever helped you. Tick mark his solution as your answer. After that you are good to attempt again.

Thanks @Tej-Singh-Rana , have marked it, thank you:

Ha ha ha, thanks for your kindness. :smile: :innocent: