The article discusses the importance of monitoring cronjobs in Google Kubernetes Engine (GKE). Cronjobs are time-based tasks that run periodically in a Kubernetes cluster, and it's essential to monitor them to ensure they are running as expected and to identify any issues or errors. The article provides insights into how to set up monitoring for cronjobs using various tools. By monitoring cronjobs, developers can proactively identify and fix issues, prevent downtime, and ensure the reliability of their GKE applications.
$ kubectl cluster-info
Output:
vi job.yaml
Input:
apiVersion: batch/v1
kind: Job
metadata:
  name: helloworld
spec:
  template:
    spec:
      containers:
      - name: busybox
        image: busybox
        command: ["echo", "Hello Kubernetes!!!"]
      restartPolicy: Never
Now hit this command to create job
$ kubeclt create -f job.yaml
Output:
job.batch/helloworld created
Now hit this command to watch all
$ watch kubectl get all
Every 2.0s: kubectl get all                                                                                                                      cs-6000-devshell-vm-0c4755a8-b531-4460-b60e-1fb2786e220b: Sat Jul  4 14:52:47 2020
NAME                   READY   STATUS      RESTARTS   AGE
pod/helloworld-dfr2k   0/1     Completed   0          4m25s
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.8.0.1     <none>        443/TCP   23m
NAME                   COMPLETIONS   DURATION   AGE
job.batch/helloworld   1/1           2s         4m26s
$ kubectl describe job helloworld
Output:
lab_aa43f292201f@cloudshell:~ (lab-gcp)$ kubectl describe job helloworld
Name:           helloworld
Namespace:      default
Selector:       controller-uid=1e48440c-bdd3-11ea-85d1-42010a8000e4
Labels:         controller-uid=1e48440c-bdd3-11ea-85d1-42010a8000e4
               job-name=helloworld
Annotations:    <none>
Parallelism:    1
Completions:    1
Start Time:     Sat, 04 Jul 2020 14:48:23 +0600
Completed At:   Sat, 04 Jul 2020 14:48:25 +0600
Duration:       2s
Pods Statuses:  0 Running / 1 Succeeded / 0 Failed
Pod Template:
 Labels:  controller-uid=1e48440c-bdd3-11ea-85d1-42010a8000e4
          job-name=helloworld
 Containers:
  busybox:
   Image:      busybox
   Port:       <none>
   Host Port:  <none>
   Command:
     echo
     Hello Kubernetes!!!
   Environment:  <none>
   Mounts:       <none>
 Volumes:        <none>
Events:
 Type    Reason            Age    From            Message
 ----    ------            ----   ----            -------
 Normal  SuccessfulCreate  7m22s  job-controller  Created pod: helloworld-dfr2k
Finally, to delete hit
$ kubectl delete job helloworld
student_02_aa43f292201f@cloudshell:~ (labs-gcp-b17e65df)$ kubectl delete job helloworld
job.batch "helloworld" deleted
Congratulations
I hope we learn something exciting about gRPC framework. Thanks for time & passion. Feel free to ask me anything.
Say Hi to me on Twitter, Linkedin, and Medium where I keep on sharing interesting updates.
 
 
              
 
    
Top comments (0)