Tuesday 29 June 2021

Running Batch Files in Kubernetes (KSH Files)

 Check out the files from the Github here.


Navigate to the Folder location where the checkout is done. Execute the Below commands. 


C:\Users\Syed\Hello-K8s_Job> kubectl create configmap hello --from-file=hello.ksh

configmap/hello created


It creates the config map from the Script provided.


C:\Users\Syed\Hello-K8s_Job>kubectl apply -f deployment.yaml

cronjob.batch/hello-job created


creates the cron job with the deployment.yml


Access the minikube Dashboard.




In the Cron Jobs tab, we can see the Job Created name "hello-job".


Once if you click the job, you will find the below tab as the Active and Inactive jobs. All the Jobs Executing Currently will be in the Active Jobs, Finished Jobs will be in the Inactive Jobs. 


In case, If you need to trigger the job manually then you need to press the play button in the right side top the title bar.





When you look inside the Logs of the Jobs executed we can see the Loggins added.




You can apply the same procedure for the complex KSH scripts as well.


Happy Learning.!!!!

No comments:
Write comments