Skip to content

Commit bbb83c2

Browse files
committed
Lab 9, bonus task
1 parent a4c85e2 commit bbb83c2

File tree

4 files changed

+131
-0
lines changed

4 files changed

+131
-0
lines changed

k8s/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,75 @@ $ minikube service --all
4040
Opening in existing browser session.
4141
$
4242
```
43+
44+
## Ingress
45+
46+
```
47+
$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/ ; echo
48+
* Added kolay.ne:80:192.168.49.2 to DNS cache
49+
* Hostname kolay.ne was found in DNS cache
50+
* Trying 192.168.49.2:80...
51+
* Connected to kolay.ne (192.168.49.2) port 80
52+
> GET / HTTP/1.1
53+
> Host: kolay.ne
54+
> User-Agent: curl/8.7.1
55+
> Accept: */*
56+
>
57+
* Request completely sent off
58+
< HTTP/1.1 404 Not Found
59+
< Date: Fri, 29 Mar 2024 13:58:46 GMT
60+
< Content-Type: text/html
61+
< Content-Length: 146
62+
< Connection: keep-alive
63+
<
64+
<html>
65+
<head><title>404 Not Found</title></head>
66+
<body>
67+
<center><h1>404 Not Found</h1></center>
68+
<hr><center>nginx</center>
69+
</body>
70+
</html>
71+
* Connection #0 to host kolay.ne left intact
72+
73+
$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/time ; echo
74+
* Added kolay.ne:80:192.168.49.2 to DNS cache
75+
* Hostname kolay.ne was found in DNS cache
76+
* Trying 192.168.49.2:80...
77+
* Connected to kolay.ne (192.168.49.2) port 80
78+
> GET /time HTTP/1.1
79+
> Host: kolay.ne
80+
> User-Agent: curl/8.7.1
81+
> Accept: */*
82+
>
83+
* Request completely sent off
84+
< HTTP/1.1 200 OK
85+
< Date: Fri, 29 Mar 2024 13:58:51 GMT
86+
< Content-Type: text/html; charset=utf-8
87+
< Content-Length: 60
88+
< Connection: keep-alive
89+
<
90+
* Connection #0 to host kolay.ne left intact
91+
In MSK it's 16:57:49. Have you brushed your teeth today yet?
92+
$ curl --resolve "kolay.ne:80:$( minikube ip )" --verbose http://kolay.ne/cats ; echo
93+
* Added kolay.ne:80:192.168.49.2 to DNS cache
94+
* Hostname kolay.ne was found in DNS cache
95+
* Trying 192.168.49.2:80...
96+
* Connected to kolay.ne (192.168.49.2) port 80
97+
> GET /cats HTTP/1.1
98+
> Host: kolay.ne
99+
> User-Agent: curl/8.7.1
100+
> Accept: */*
101+
>
102+
* Request completely sent off
103+
< HTTP/1.1 200 OK
104+
< Date: Fri, 29 Mar 2024 13:58:56 GMT
105+
< Content-Type: text/plain; charset=utf-8
106+
< Content-Length: 162
107+
< Connection: keep-alive
108+
<
109+
* Connection #0 to host kolay.ne left intact
110+
There is a species of cat smaller than the average housecat. It is native to Africa and it is the Black-footed cat (Felis nigripes). Its top weight is 5.5 pounds.
111+
$
112+
```
113+
114+
Note: 5.5 pounds is about 2.49 kilograms

k8s/ingress.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: combined-web-app
5+
annotations:
6+
nginx.ingress.kubernetes.io/rewrite-target: /
7+
spec:
8+
rules:
9+
- host: kolay.ne
10+
http:
11+
paths:
12+
- path: /time
13+
pathType: Prefix
14+
backend:
15+
service:
16+
name: web-app-py
17+
port: {number: 5000}
18+
- path: /cats
19+
pathType: Prefix
20+
backend:
21+
service:
22+
name: web-app-go
23+
port: {number: 5050}

k8s/web-app-go-deployment.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: web-app-go
5+
spec:
6+
replicas: 3
7+
selector:
8+
matchLabels:
9+
app: web-app-go
10+
template:
11+
metadata:
12+
labels:
13+
app: web-app-go
14+
spec:
15+
containers:
16+
- name: web-app-go
17+
image: kolay0ne/app_go:lab8
18+
ports:
19+
- containerPort: 5000
20+
name: web-ui
21+
strategy:
22+
type: RollingUpdate
23+
rollingUpdate:
24+
maxUnavailable: 1

k8s/web-app-go-service.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: web-app-go
5+
spec:
6+
selector:
7+
app: web-app-go
8+
ports:
9+
- protocol: TCP
10+
port: 5050
11+
targetPort: web-ui
12+
type: LoadBalancer

0 commit comments

Comments
 (0)