Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes 3 #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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 kubernetes/reddit/mongo-claim-dynamic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#для тестов
1 change: 1 addition & 0 deletions kubernetes/reddit/mongo-claim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#пустой
8 changes: 4 additions & 4 deletions kubernetes/reddit/mongo-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: reddit
component: mongo
comment-db: "true" # Лейбл в deployment, чтобы было понятно, что рзавернуто
comment-db: "true"
post-db: "true"
spec:
replicas: 1
Expand All @@ -20,8 +20,6 @@ spec:
labels:
app: reddit
component: mongo
comment-db: "true"
post-db: "true"
spec:
containers:
- image: mongo:3.2
Expand All @@ -30,5 +28,7 @@ spec:
- name: mongo-persistent-storage
mountPath: /data/db
volumes:
#name: mongo-gce-pd-storage
- name: mongo-persistent-storage
emptyDir: {}
persistentVolumeClaim:
claimName: mongo-pvc
25 changes: 25 additions & 0 deletions kubernetes/reddit/mongo-network-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-db-traffic
namespace: dev
labels:
app: reddit
spec:
podSelector:
matchLabels:
app: reddit
component: mongo
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: reddit
component: comment
- podSelector:
matchLabels:
app: reddit
component: post
17 changes: 17 additions & 0 deletions kubernetes/reddit/mongo-pv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-pv
spec:
storageClassName: ""
capacity:
storage: 4Gi
accessModes:
- ReadWriteOnce
csi:
driver: disk-csi-driver.mks.ycloud.io
fsType: ext4
volumeHandle: fhmfbg6e9asljv8ivr2c
13 changes: 13 additions & 0 deletions kubernetes/reddit/mongo-pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pvc
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
volumeName: mongo-pv
1 change: 1 addition & 0 deletions kubernetes/reddit/mongo-volume.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#для тестов
50 changes: 50 additions & 0 deletions kubernetes/reddit/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
apiVersion: v1
kind: Secret
metadata:
name: ui-ingress
type: kubernetes.io/tls
data:
# the data is abbreviated in this example
tls.crt: |
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lVSFBOZlV5eWtM
emlldVYxRVhuQlRLZlgvUUlVd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0dURVhNQlVHQTFVRUF3d09N
VE13TGpFNU15NDBNaTR4T0RVd0hoY05Nakl3TmpBeE1USXlPVFEzV2hjTgpNak13TmpBeE1USXlP
VFEzV2pBWk1SY3dGUVlEVlFRRERBNHhNekF1TVRrekxqUXlMakU0TlRDQ0FTSXdEUVlKCktvWklo
dmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUtQQlR2SlB1cVZManZUUno2OEVIRVB5bGp3bE10
alkKRlJ1TUV1NUE4SnJaaFNQbWZhSnZiUXNoTDR4SHN1Q0xVd0NyZUlVbS9pS0NaaDJxU0VzN0FX
R2p4U2RURThCSApCNEVpT3B6aU9aUXgvRG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zlqMkFM
bkp3ZG8rMkJCClhQdVhYWElRbEErV1h5ZDR1V0tpaS91NDJrVzdsSzdKbmZtYkN4YVZFeE1Zd2Rx
WEE1QS81T2E0NzJocG5RaysKV25NbldKOGpZNUh6MzVZSHNsTExlY1VhRXBEY0ZvZGVSVkdvaGNi
a0pyVHQ5R1hndmRyN2NsM0tiKzRQb21PVwp3NTQxVDhsckU4ZHc1RU0ySlpadVJHcTJTbU1BZ29U
N1dLem1YbGVnUjVIbUsvYjZxMlRFV05GRnZxT2FLNmRCClNqYXd4YzlBMWdEcE5TZzkzR0JCcjBl
ZXF4Ylh3eCtzN3BNSS9JY0Y3NzdYWU9FbWQ2NjhIRU1yYVhXeThYdEMKN0daeXd6S0tZdXptaW93
ZHpnQUVaRGI3Q09keVJUND0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
1 change: 1 addition & 0 deletions kubernetes/reddit/storage-fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#для тестов
19 changes: 19 additions & 0 deletions kubernetes/reddit/tls.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDEzCCAfugAwIBAgIUHPNfUyykLzieuV1EXnBTKfX/QIUwDQYJKoZIhvcNAQEL
BQAwGTEXMBUGA1UEAwwOMTMwLjE5My40Mi4xODUwHhcNMjIwNjAxMTIyOTQ3WhcN
MjMwNjAxMTIyOTQ3WjAZMRcwFQYDVQQDDA4xMzAuMTkzLjQyLjE4NTCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKPBTvJPuqVLjvTRz68EHEPyljwlMtjY
FRuMEu5A8JrZhSPmfaJvbQshL4xHsuCLUwCreIUm/iKCZh2qSEs7AWGjxSdTE8BH
B4EiOpziOZQx/Dnu5HR/+LMIuhOgk9yX1VHrNnqN5f6MWTyglqBgIjG7CFC+iDos
lWyhD9CAKbW0OLswpCT6KLzO49zWgDEaFAnoz+b1Y5D2Fi8e7JVSxcNP5YsCwYav
zpCBOz7bViCTiFlnAInXYi4Lmw/pSv7g56VojY4UfVJQGw818qaPiZGW6ug0X46P
JRsy+6rtCMs+QbalKE8S74hNh7sQQNKXQf4w81iQsvvNrMLHSkoV4ccCAwEAAaNT
MFEwHQYDVR0OBBYEFKjuB5QkbiekF1fTWb+8AZKx6GP5MB8GA1UdIwQYMBaAFKju
B5QkbiekF1fTWb+8AZKx6GP5MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
BQADggEBAJBH7kXlCKY8O+rEHG18EVIOvlVr+o3nITpwxJNE2w9j2ALnJwdo+2BB
XPuXXXIQlA+WXyd4uWKii/u42kW7lK7JnfmbCxaVExMYwdqXA5A/5Oa472hpnQk+
WnMnWJ8jY5Hz35YHslLLecUaEpDcFodeRVGohcbkJrTt9GXgvdr7cl3Kb+4PomOW
w541T8lrE8dw5EM2JZZuRGq2SmMAgoT7WKzmXlegR5HmK/b6q2TEWNFFvqOaK6dB
Sjawxc9A1gDpNSg93GBBr0eeqxbXwx+s7pMI/IcF777XYOEmd668HEMraXWy8XtC
7GZywzKKYuzmiowdzgAEZDb7COdyRT4=
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions kubernetes/reddit/tls.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCjwU7yT7qlS470
0c+vBBxD8pY8JTLY2BUbjBLuQPCa2YUj5n2ib20LIS+MR7Lgi1MAq3iFJv4igmYd
qkhLOwFho8UnUxPARweBIjqc4jmUMfw57uR0f/izCLoToJPcl9VR6zZ6jeX+jFk8
oJagYCIxuwhQvog6LJVsoQ/QgCm1tDi7MKQk+ii8zuPc1oAxGhQJ6M/m9WOQ9hYv
HuyVUsXDT+WLAsGGr86QgTs+21Ygk4hZZwCJ12IuC5sP6Ur+4OelaI2OFH1SUBsP
NfKmj4mRluroNF+OjyU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RTxN
pMsXQupFt174EBVYJSHqzKaZ8G8htwWux7mftHN5AoGBAMqneLTyTKEkj5JML82M
uE8vMP1EkrQkI85FLWh4ll4uiBgZu01GNfgTZprwMem4UeRRWQVGOij+emJXzGem
rDDtWUXOkVKZCQyDYa2KxDNkqtQqdeouypGDKo1oQNIBfaNXNp2V30KSduoglLMt
r6z7Wnh017XzFKom1/WZMaVU
-----END PRIVATE KEY-----
20 changes: 20 additions & 0 deletions kubernetes/reddit/ui-ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ui-ingress
annotations:
kubernetes.io/ingress.allow-http: "false"
spec:
tls:
- secretName: ui-ingress
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ui
port:
number: 9292
9 changes: 4 additions & 5 deletions kubernetes/reddit/ui-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ metadata:
app: reddit
component: ui
spec:
type: NodePort # Главное отличие - тип сервиса NodePort
type: NodePort
ports:
- nodePort: 32092
port: 9292
- port: 9292
protocol: TCP
targetPort: 9292
selector:
app: reddit
component: ui
app: reddit
component: ui