Skip to content

Commit e160da5

Browse files
committed
[chore]: add istio service mesh in ambient mode
1 parent c4c064a commit e160da5

File tree

10 files changed

+192
-0
lines changed

10 files changed

+192
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# deploy sample application and add it to mes
4+
# with istio
5+
6+
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.28/samples/bookinfo/platform/kube/bookinfo.yaml
7+
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.28/samples/bookinfo/platform/kube/bookinfo-versions.yaml
8+
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.28/samples/bookinfo/gateway-api/bookinfo-gateway.yaml
9+
kubectl annotate gateway bookinfo-gateway networking.istio.io/service-type=ClusterIP --namespace=default
10+
kubectl label namespace default istio.io/dataplane-mode=ambient
11+
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.28/samples/addons/prometheus.yaml
12+
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.28/samples/addons/kiali.yaml
13+
14+
kubectl port-forward svc/bookinfo-gateway-istio 8080:80

0x5-service_mesh/deployment.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: hello-dep-v1
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: hello
10+
version: v1
11+
template:
12+
metadata:
13+
labels:
14+
app: hello
15+
version: v1
16+
spec:
17+
containers:
18+
- name: seedimage
19+
image: akhonya/kube-hello:v1
20+
21+
---
22+
apiVersion: v1
23+
kind: Service
24+
metadata:
25+
name: hello-svc-v1
26+
spec:
27+
type: ClusterIP
28+
selector:
29+
app: hello
30+
version: v1
31+
ports:
32+
- port: 80
33+
protocol: TCP
34+
targetPort: 8080
35+
36+
37+
---
38+
apiVersion: apps/v1
39+
kind: Deployment
40+
metadata:
41+
name: hello-dep-v2
42+
spec:
43+
replicas: 1
44+
selector:
45+
matchLabels:
46+
app: hello
47+
version: v2
48+
template:
49+
metadata:
50+
labels:
51+
app: hello
52+
version: v2
53+
spec:
54+
containers:
55+
- name: seedimage
56+
image: akhonya/kube-hello:v2
57+
58+
---
59+
apiVersion: v1
60+
kind: Service
61+
metadata:
62+
name: hello-svc-v2
63+
spec:
64+
type: ClusterIP
65+
selector:
66+
app: hello
67+
version: v2
68+
ports:
69+
- port: 80
70+
protocol: TCP
71+
targetPort: 8080

0x5-service_mesh/gateway.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: Gateway
3+
metadata:
4+
name: hello-gateway
5+
spec:
6+
gatewayClassName: istio
7+
listeners:
8+
- name: http
9+
port: 80
10+
protocol: HTTP
11+
allowedRoutes:
12+
namespaces:
13+
from: Same
14+
15+
---
16+
apiVersion: gateway.networking.k8s.io/v1
17+
kind: HTTPRoute
18+
metadata:
19+
name: hello
20+
spec:
21+
parentRefs:
22+
- name: hello-gateway
23+
rules:
24+
- matches:
25+
- path:
26+
type: Exact
27+
value: /
28+
backendRefs:
29+
- name: hello-svc-v1
30+
port: 80
31+
weight: 75
32+
- name: hello-svc-v2
33+
port: 80
34+
weight: 25
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
FROM node:lts-alpine3.21
3+
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
8+
RUN npm install
9+
10+
COPY . .
11+
12+
EXPOSE 8080
13+
14+
CMD ["node", "index.js"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### Hello for UH DevOps with Docker
2+
3+
HTTP GET /
4+
5+
mluukkai/hello:1 responds with "Hello, World!"
6+
7+
mluukkai/hello:2 responds with "Hello, New World!"
8+
9+
https://hub.docker.com/repository/docker/mluukkai/hello/tags
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const express = require('express');
2+
3+
const app = express();
4+
const port = 8080;
5+
6+
app.get('/', (req, res) => {
7+
// akhonya/kube-hello:v1 responds with "Hello, World!"
8+
// akhonya/kube-hello:v2 responds with "Hello, Brave New World!"
9+
res.send('Hello, Brave New World!');
10+
});
11+
12+
app.listen(port, () => {
13+
console.log(`Server is running at http://localhost:${port}`);
14+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"express": "^5.1.0"
4+
}
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
5+
resources:
6+
- "deployment.yaml"
7+
- "gateway.yaml"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: ResourceQuota
3+
metadata:
4+
name: gcp-critical-pods
5+
namespace: istio-system
6+
spec:
7+
hard:
8+
pods: 1000
9+
scopeSelector:
10+
matchExpressions:
11+
- operator: In
12+
scopeName: PriorityClass
13+
values:
14+
- system-node-critical

0x5-service_mesh/setup.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
# install istio ambient mode in the cluster
3+
4+
if ! command -v istioctl; then
5+
echo "istioctl is not installed"
6+
exit 1
7+
fi
8+
9+
istioctl install --set profile=ambient --set values.global.platform=gke
10+

0 commit comments

Comments
 (0)