Skip to content

Commit 3a22f90

Browse files
author
esenkus
committed
simplify setup, add more labels
1 parent 9349471 commit 3a22f90

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ node .
2323
## Advanced local setup with kubernetes
2424
* install kubernetes
2525
* deploy app with `kubectl apply -f deploy`
26-
* check the assigned NodePort for the service `kubectl get svc testwebapp`
27-
* find out node port `kubectl get svc` the port will be the second port
26+
* check the ip and port of the app `kubectl get services -n team1`. The ip will be ExternalIP and the port will be second one in Port column
2827
* connect to the app
29-
* find out NodePort ip `kubectl get nodes -o wide`
3028
* connect to url `http://<node-ip>:<node-port>`
31-
* (optional) or forward the NodePort port `kubectl port-forward svc/testwebapp <nodeport>:8080` and connect with `http://localhost:<node-port>`
3229
* uninstall app with `kubectl delete -f deploy`
3330

3431
## Building docker image
35-
32+
For local testing you might just want to build and run image without any kubernetes.
3633
* build image `docker build -t test-app .`
3734
* run image `docker run -p 8080:8080 -d test-app`
3835
* check if it is running by `docker ps`

deploy/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ metadata:
55
namespace: team1
66
labels:
77
app: testwebapp
8+
team: team1
89
spec:
910
replicas: 1
1011
selector:
1112
matchLabels:
1213
app: testwebapp
14+
team: team1
1315
template:
1416
metadata:
1517
labels:
1618
app: testwebapp
19+
team: team1
1720
spec:
1821
containers:
1922
- name: testwebapp

deploy/service.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ metadata:
66
spec:
77
selector:
88
app: testwebapp
9+
team: team1
910
ports:
1011
- protocol: TCP
1112
port: 8080
1213
targetPort: 8080
13-
type: NodePort
14+
nodePort: 30008
15+
# will still use NodePort if LoadBalancer is not supported
16+
type: LoadBalancer

0 commit comments

Comments
 (0)