Skip to content

Latest commit

 

History

History
72 lines (37 loc) · 3.75 KB

Task12.md

File metadata and controls

72 lines (37 loc) · 3.75 KB

Task: https://docs.google.com/document/d/1II6ierjiGgJrsylja6K6Eq4ZEh8gHGhS/edit

Solution

  1. You can get information about worker nodes in Kubernetes by using the kubectl get nodes command and save the output to a file using the following command:

    kubectl get nodes -o wide > nodes.txt

The -o wide flag provides additional information about the nodes, and the > nodes.txt redirects the output to a file named nodes.txt. You can then inspect this file to see information such as the node name, status, and capacity. Link to nodes.txt - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/f1a1d43ba0933695922ec45d1531511a94fa30f0/k8s/nodes.txt

  1. You can create a new namespace in Kubernetes using the following command:

     kubectl create namespace <namespace-name>
    

The resoult:

Screenshot_4

  1. Verify that our cluster is empty:

Screenshot_5

Create Deployment with 3 replicas in "basecamp" namespace:

The hole K8s manifest wich create Deployment and Services is available by the link: https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/21f9f0745bc51acd45cf0b86171ef57e03fd69f4/k8s/deployment.yaml

Screenshot_6

Create ClusterIP Service:

Screenshot_7

Let's check how it works. Go to the worker node via ssh and check the default Nginx page:

Screenshot_8

Create NodePort service:

Screenshot_9

Let's check nodes IP:

Screenshot_10

And go to worker node and check default Nginx page via 30080 port:

Screenshot_11

And logs from one of the pods:

Screenshot_12

  1. A Kubernetes Job manifest file that will curl an Nginx page via ClusterIP is available - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/3e7106247a15af778ab110a8d329e22e5d627843/k8s/Job1.yaml

The resoult is on next screen:

Screenshot_27

This job uses the radial/busyboxplus:curl image, which includes the curl utility, and runs a shell script that uses curl to access the Nginx default webpage on ClusterIP. The backoffLimit field specifies the number of retries the job will make before giving up. The restartPolicy field is set to Never to prevent the pod from restarting if the curl command fails.

The second job is right the same, so i will not describe it. Resolts:

Screenshot_28

Manifest is available by the link - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/3e7106247a15af778ab110a8d329e22e5d627843/k8s/job2.yaml

  1. CronJob. Full manifest is available by the link - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/583ee9d4372a35ed043bf29d142f42a2d0716f53/k8s/job3.yaml

Resoults:

Screenshot_29