forked from HariSekhon/Diagrams-as-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes_external_traffic_policy.d2
executable file
·116 lines (111 loc) · 3.22 KB
/
kubernetes_external_traffic_policy.d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env d2 --theme 200
#
# Author: Hari Sekhon
# Date: 2023-05-07 03:02:50 +0100 (Sun, 07 May 2023)
#
# vim:ts=2:sts=2:sw=2:et:filetype=d2
#
# https://github.com/HariSekhon/Diagrams-as-Code
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# K u b e r n e t e s E x t e r n a l T r a f f i c P o l i c y
# ============================================================================ #
title: {
label: Kubernetes Service External Traffic Policy
near: top-center
shape: text
style.font-size: 40
style.underline: true
}
classes: {
load_balancer: {
label: GKE Load Balancer
icon: https://icons.terrastruct.com/gcp%2FProducts%20and%20services%2FNetworking%2FCloud%20Load%20Balancing.svg
shape: image
}
service: {
label: Service
icon: https://diagrams.mingrammer.com/img/resources/k8s/network/svc.png
shape: image
}
pod: {
label: Pod
icon: https://diagrams.mingrammer.com/img/resources/k8s/compute/pod.png
shape: image
}
animated: {
style.animated: true
}
animated_local: {
label: Traffic only sent to local pod\nmaintains client source IP address
style.animated: true
}
no_traffic: {
label: No Traffic\nLB Health Check\ndetermines no pod\non this server\n\n\n.
style.stroke-dash: 5
}
}
lb: { class: load_balancer }
Kubernetes {
style.double-border: true
ext: "External Traffic Policy: Cluster" {
server1: Server {
service1 { class: service }
pod1 { class: pod }
_._._.lb -> service1 { class: animated }
service1 -> pod1 { class: animated }
service1 -> _.server2.pod2 { class: animated }
service1 -> _.server3.pod3 { style.opacity: 0 }
}
server2: Server {
service2 { class: service }
pod2 { class: pod }
_._._.lb -> service2 { class: animated }
service2 -> pod2 { class: animated }
service2 -> _.server1.pod1 { class: animated }
}
server3: Server {
service3 { class: service }
_._._.lb -> service3 { class: animated }
pod3 {
class: pod
style.opacity: 0.5
label: Pod not running here
}
service3 -> _.server1.pod1 { class: animated }
service3 -> _.server2.pod2 { class: animated }
}
}
local: "External Traffic Policy: Local" {
server4: Server {
service4 { class: service }
service4.label: Service Unused
pod4 {
class: pod
style.opacity: 0.5
label: Pod not running here
}
_._._.lb -- service4 { class: no_traffic }
service4 -> pod4 { style.opacity: 0 }
}
server5: Server {
service5 { class: service }
pod5 { class: pod }
_._._.lb -> service5 { class: animated }
service5 -> pod5 { class: animated_local }
#service5 -> _.server4.pod4 { style.opacity: 0 }
}
server6: Server {
service6 { class: service }
pod6 { class: pod }
_._._.lb -> service6 { class: animated }
service6 -> pod6 { class: animated_local }
}
}
}