Skip to content

Commit

Permalink
day 31 devops
Browse files Browse the repository at this point in the history
  • Loading branch information
kranurag7 authored May 8, 2022
1 parent dd727c7 commit afb6b83
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Anurag_Kumar/Kubernetes/kubernetes-basics/k8s-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- When I started with kubernetes, in the starting months I have only learnt about pods and deployments mainly.
- Today I tried to learn about jobs.
- To set up jobs in kubernetes I tried creating a container image and using that image I tried to run a job in my kubernetes cluster.

- I tried writing this simple go program that will run for 10 seconds.
```go
package main

import (
"fmt"
"time"
)

func main() {
fmt.Println("Starting job at time 😐 : ", time.Now().Format("01-02-2006 Monday 15:04:05"))
fmt.Println("Doing my Job...")
time.Sleep(time.Second * 7)
fmt.Println("Just few seconds more to finish 🙃")
time.Sleep(time.Second * 3)
fmt.Println("Finishing job at time 😎 : ", time.Now().Format("01-02-2006 Monday 15:04:05"))
}
```


- I created a Dockerfile to containerize the above program
```Dockerfile
FROM golang:alpine
COPY . .
CMD ["go", "run", "main.go"]
```

- Create the container image using `podman build -t kranurag7/simplejob .`
- push the image to container registry using `podman push kranurag7/simplejob`
1 change: 1 addition & 0 deletions Anurag_Kumar/Progress/031/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Revised the concept of kubernetes jobs
3 changes: 2 additions & 1 deletion Anurag_Kumar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
- [x] 27 > [Networking Devices](Progress/027/Readme.md)
- [x] 28 > [Configmap and secret](Progress/028/Readme.md)
- [x] 29 > [Falco](Progress/029/Readme.md)
- [x] 30 > [linux networking and apparmor](Progress/030/Readme.md)
- [x] 30 > [linux networking and apparmor](Progress/030/Readme.md)
- [x] 31 > [Kubernetes Jobs](Progress/031/Readme.md)

0 comments on commit afb6b83

Please sign in to comment.