Task: https://docs.google.com/document/d/1II6ierjiGgJrsylja6K6Eq4ZEh8gHGhS/edit
-
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
-
You can create a new namespace in Kubernetes using the following command:
kubectl create namespace <namespace-name>
The resoult:
- Verify that our cluster is empty:
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
Create ClusterIP Service:
Let's check how it works. Go to the worker node via ssh and check the default Nginx page:
Create NodePort service:
Let's check nodes IP:
And go to worker node and check default Nginx page via 30080 port:
And logs from one of the pods:
- 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:
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:
Manifest is available by the link - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/3e7106247a15af778ab110a8d329e22e5d627843/k8s/job2.yaml
- CronJob. Full manifest is available by the link - https://github.com/AndrukhivAndriy/DevOps-BaseCamp/blob/583ee9d4372a35ed043bf29d142f42a2d0716f53/k8s/job3.yaml
Resoults: