Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/*
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# springboot-k8s-yaml
# springboot-k8s-yaml

1. Run spring boot app in docker \
```docker build -t springboot-k8-example:1.1 . ```
2. Create/update deployment \
``` kubectl apply -f deployment.yaml```
3. check the deployment \
```kubectl get deployments```
4. check the pods \
``` kubectl get pods```
5. Get deployment logs \
``` kubectl logs deployment/spring-boot-k8s```
6. Get pod log \
```kubectl logs <POD-NAME>```
7. run service file \
``` kubectl apply -f .\service.yaml```
8. Get all the service \
```kubectl get svc```
9. access the link using \
``` NodeInternalIP:<NODE-PORT>```


Reference:
1. https://stackoverflow.com/questions/60518658/how-to-get-logs-of-deployment-from-kubernetes
2.
4 changes: 2 additions & 2 deletions deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ spec:
selector:
matchLabels:
app: spring-boot-k8s
replicas: 2 # Number of replicas that will be created for this deployment
replicas: 3 # Number of replicas that will be created for this deployment
template:
metadata:
labels:
app: spring-boot-k8s
spec:
containers:
- name: spring-boot-k8s
image: springboot-k8s-example:1.0 # Image that will be used to containers in the cluster
image: springboot-k8-example:1.1 # Image that will be used to containers in the cluster
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080 # The port that the container is running on in the cluster