hinzugefügt "Init" der bissher gemachten Bereiche: Kubernetes, ISTIO, caddy-server, postgress, helm

This commit is contained in:
David Aster 2022-10-06 13:39:15 +02:00
commit e941ec6ba2
86 changed files with 18019 additions and 0 deletions

6037
ISTIO/1-istio-init.yaml Normal file

File diff suppressed because it is too large Load Diff

6159
ISTIO/2-istio-minikube.yaml Normal file

File diff suppressed because one or more lines are too long

11
ISTIO/3-kiali-secret.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: kiali
namespace: istio-system
labels:
app: kiali
data:
username: YWRtaW4=
passphrase: YWRtaW4=

View File

@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: default

View File

@ -0,0 +1,204 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: position-simulator
spec:
selector:
matchLabels:
app: position-simulator
replicas: 1
template: # template for the pods
metadata:
labels:
app: position-simulator
spec:
containers:
- name: position-simulator
image: richardchesterwood/istio-fleetman-position-simulator:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
command: ["java","-Xmx50m","-jar","webapp.jar"]
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: position-tracker
spec:
selector:
matchLabels:
app: position-tracker
replicas: 1
template: # template for the pods
metadata:
labels:
app: position-tracker
spec:
containers:
- name: position-tracker
image: richardchesterwood/istio-fleetman-position-tracker:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
command: ["java","-Xmx50m","-jar","webapp.jar"]
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-gateway
spec:
selector:
matchLabels:
app: api-gateway
replicas: 1
template: # template for the pods
metadata:
labels:
app: api-gateway
spec:
containers:
- name: api-gateway
image: richardchesterwood/istio-fleetman-api-gateway:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
command: ["java","-Xmx50m","-jar","webapp.jar"]
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp
spec:
selector:
matchLabels:
app: webapp
replicas: 1
template: # template for the pods
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
image: richardchesterwood/istio-fleetman-webapp-angular:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vehicle-telemetry
spec:
selector:
matchLabels:
app: vehicle-telemetry
replicas: 1
template: # template for the pods
metadata:
labels:
app: vehicle-telemetry
spec:
containers:
- name: vehicle-telemtry
image: richardchesterwood/istio-fleetman-vehicle-telemetry:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: staff-service
spec:
selector:
matchLabels:
app: staff-service
replicas: 1
template: # template for the pods
metadata:
labels:
app: staff-service
spec:
containers:
- name: staff-service
image: richardchesterwood/istio-fleetman-staff-service:6
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
imagePullPolicy: Always
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-webapp
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: webapp
ports:
- name: http
port: 80
nodePort: 30080
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-position-tracker
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: position-tracker
ports:
- name: http
port: 8080
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-api-gateway
spec:
selector:
app: api-gateway
ports:
- name: http
port: 8080
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-vehicle-telemetry
spec:
selector:
app: vehicle-telemetry
ports:
- name: http
port: 8080
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-staff-service
spec:
selector:
app: staff-service
ports:
- name: http
port: 8080
type: ClusterIP

13
Kubernetes/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM Ubuntu # 1.Layer Base Ubuntu Layer
RUN apt-get update && apt-get upgrade -y # 2.Layer Changes in apt packages
RUN pip install flask flask-mysql # 3. Layer Changes in pip packages
COPY . /opt/source-code # 4.Layer Source Code
ENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run # 5.Layer Update Entrypoint

View File

@ -0,0 +1,22 @@
{
"kind": "Policy",
"spec": {
"user":"dev-user",
"namespace": "*",
"resource": "pods",
"apiGroup": "*"
}
}
{
"kind": "Policy",
"spec": {
"user":"security-1",
"namespace": "*",
"resource": "csr",
"apiGroup": "*"
}
}

File diff suppressed because it is too large Load Diff

17
Kubernetes/ca.crt Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICtzCCAZ8CFE5+q95aVSFEyu8y0yiJqR8T2jc/MA0GCSqGSIb3DQEBCwUAMBgx
FjAUBgNVBAMMDUtVQkVSTkVURVMtQ0EwHhcNMjIwNzA0MTAzMDI4WhcNMjIwODAz
MTAzMDI4WjAYMRYwFAYDVQQDDA1LVUJFUk5FVEVTLUNBMIIBIjANBgkqhkiG9w0B
AQEFAAOCAQ8AMIIBCgKCAQEA3b8q+Nxp32gUmS4C2IDrBmCKSAUyvusDrvAPX92Y
0q/ksDJG3P0xmX2cbg+gm6MXjOVrxxuYDmryu0fSlBLuTEhE40Kv7CPKUfj2Iv0n
dyEHeMFNhVAl8oQY96AQhl5N47RZLegGstqGpcENhl/kv9zyiI5xxeIGYQLoHllP
dt+6G94sJIGZENY9jStv/yW/zupKuocrpJTFvnE+pNAK7LxLGjfv2PPJqDIlTgvj
BT3g6XPS4G8pElymkhRxY/OsjuHEsrc9MFOBBuFrV+w7+EHOkdHH2b9F75rWADKs
WSpSy9GhLgH/Q1ZzpLzELWrvTsWtfLo2N5CGjVYbcuwHDQIDAQABMA0GCSqGSIb3
DQEBCwUAA4IBAQAA8P4WsYD+zMj5QS3K8qTdQTNHmbvoC+lNkPHUf0ODKpjhpjIM
U1uGwTP+B1q2IJBgN8OiwV0GAPMMlvtveSCD+meC3ncyUngg2WTZMdeMLmWKeHV7
WKwglJD0O1O4po2SshSaZ+gmu0mtau6wTOrOSBSNIfVfPMT1VMa/xoUjF9CJI4ND
WrlBoPxvqSG93EItXAlps0phTeM/JlWO/CTZzzC9QtokZ3pOkcTm6bDQ+Pp6NQlT
p2xj8+IubOAU24r8WmBUAkJqpRdXavEuF1k7axEN2+YBLYiYL8bevWz/0j8tPcAX
81te/NSQ6RA22W5POLHBHrsExJ582q7AuN5R
-----END CERTIFICATE-----

15
Kubernetes/ca.csr Normal file
View File

@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE REQUEST-----
MIICXTCCAUUCAQAwGDEWMBQGA1UEAwwNS1VCRVJORVRFUy1DQTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAN2/Kvjcad9oFJkuAtiA6wZgikgFMr7rA67w
D1/dmNKv5LAyRtz9MZl9nG4PoJujF4zla8cbmA5q8rtH0pQS7kxIRONCr+wjylH4
9iL9J3chB3jBTYVQJfKEGPegEIZeTeO0WS3oBrLahqXBDYZf5L/c8oiOccXiBmEC
6B5ZT3bfuhveLCSBmRDWPY0rb/8lv87qSrqHK6SUxb5xPqTQCuy8Sxo379jzyagy
JU4L4wU94Olz0uBvKRJcppIUcWPzrI7hxLK3PTBTgQbha1fsO/hBzpHRx9m/Re+a
1gAyrFkqUsvRoS4B/0NWc6S8xC1q707FrXy6NjeQho1WG3LsBw0CAwEAAaAAMA0G
CSqGSIb3DQEBCwUAA4IBAQBfAmhZxqkWEYlXN2HdG8QrG1MwVhIQlwuMcVidHFqd
1f2t1K/Awm26O+J1XDxv+V3lH9raW1QTLLS41oFf0lumpl55TcqUBbu/CZyQ99id
e/AIZs8fMLW15+lmaBauCKCT8J/lJgaOj6AiWhe+JJJ1YspEWdCjEhTp4cLgFs8E
9CE6i63BOgQ1jkqNJWWU5PND3M61hNi9zieD2Zs9dCFqh+w3q9UOBTR0ZG7cSm9t
ee1qf2V+NPtQOPkUSTrrTwCFW3Cij5lsYmfH9QtGkAx+I8IXiAFX/NKXaN3+6wX1
XvjpeerTsGfVeW7AsCADFSy8173bJIOU1I7ECSqTaGMG
-----END CERTIFICATE REQUEST-----

27
Kubernetes/ca.key Normal file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA3b8q+Nxp32gUmS4C2IDrBmCKSAUyvusDrvAPX92Y0q/ksDJG
3P0xmX2cbg+gm6MXjOVrxxuYDmryu0fSlBLuTEhE40Kv7CPKUfj2Iv0ndyEHeMFN
hVAl8oQY96AQhl5N47RZLegGstqGpcENhl/kv9zyiI5xxeIGYQLoHllPdt+6G94s
JIGZENY9jStv/yW/zupKuocrpJTFvnE+pNAK7LxLGjfv2PPJqDIlTgvjBT3g6XPS
4G8pElymkhRxY/OsjuHEsrc9MFOBBuFrV+w7+EHOkdHH2b9F75rWADKsWSpSy9Gh
LgH/Q1ZzpLzELWrvTsWtfLo2N5CGjVYbcuwHDQIDAQABAoIBAFHS89Fmy+5zIn6v
mr83OwJcZ0pSGLqYUACidpniVD0SSKm3s6xiBYZk8m8udw5XLR6BnbaX+REA59ax
lwOqxKIDXOAbQH07a7G502Fv1rs/xdkKQ0e5HneRxQDC4LYkYEtwxiOJZcdjmaHa
TdpS0j72EczP+y2QzNfJUcu5Gvh6v8SfhBvGJks6HwK+zcONQ/b8Qxm10nW/dydL
455pOmhv/kY0SOgP17DjW2doPvQ+dWaxda/J3x8jSxoptPV8LGBLo+FesqTe6g6g
1I5URaI5+L86zDHlmCG+IaNH1q3ffS6rQxhl/T/Oal+WU59dCqqLPAqd4xgy9vnj
Z82CLkUCgYEA+1UwMAurQdlj+ioFUJ/a6KdOKJduKuOLwLXeyJL4Qupk9e7IHtG1
RZv3uIeXKesD+LD4VF+ejTeL47UKpXbh1sfKsRuHaw8UP6TuJEWdRbmdvDN7a13e
7n9vJwjmaKaoR8E/3wnHw5frDQyah/0d6QOkP7G4Bx5BXSqZIzU6dmMCgYEA4d1U
nvrdn4O+1udmsQKMbO7CzYuKGfa3pYImupmWkCv7ZZNn8zIxrXvo00gNhwPf+P9s
9KPGPEuYAeMoshgkengLcNInrhmQ/YKmyBdkOr24BBX/b3/elYABIm7klgmxK9MF
KztYpnZ7lbOjorIZR7gSVnPa7HsHCalB+Y33j88CgYB839yrYoDanNpxx0MQxfwM
MGRDAso4AQrE2xgv6+XxyWgUUWmY9nTsewvf4W6X4y7792HK+h9a5shYgPEjOSgI
gQgSay0jYkCbRqUT3IrBw/G9Oo8Nz3weX66oZGGmiXd+/2Nuu/tHEUo2F5cIDhk4
VxjalMBsuPmdArdHqQC9JQKBgBqnefMA++J1M7I8wJunB1dbndWP4A5MVUPM5jEj
Kud8qUBFcwD6LW6hrsowOJh0VpwV2I/OO/ilmxyt6AGMY9GoFQGNa21aSwf/wRrf
184u0WZ6ChjoaCYQYxHjMEqcfjIDxxpg+Ic8eD0kY+0xQ1Z5XICjT3SU2DHFral7
nXl1AoGBAIf0TbYJj9wou8nkN6aYFLPN8u5EcnW1PNjf3eBt99Fr5U66Bz2PAjDR
Hu9S0f02rBInC8lbuCVBm8FZDZujxRLkLGDnwTsL4pltYqAoGEnIL4WPYQcoQ1Km
q9jMonHy/SurQfCXpxt3MG8F808xdsOKSKJ3pVjPXQ8HrAxceNXp
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,13 @@
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: davida
spec:
groups:
- system:authenticated
request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ1ZqQ0NBVDRDQVFBd0VURVBNQTBHQTFVRUF3d0dZV3R6YUdGNU1JSUJJakFOQmdrcWhraUc5dzBCQVFFRgpBQU9DQVE4QU1JSUJDZ0tDQVFFQXY4azZTTE9HVzcrV3JwUUhITnI2TGFROTJhVmQ1blNLajR6UEhsNUlJYVdlCmJ4RU9JYkNmRkhKKzlIOE1RaS9hbCswcEkwR2xpYnlmTXozL2lGSWF3eGVXNFA3bDJjK1g0L0lqOXZQVC9jU3UKMDAya2ZvV0xUUkpQbWtKaVVuQTRpSGxZNDdmYkpQZDhIRGFuWHM3bnFoenVvTnZLbWhwL2twZUVvaHd5MFRVMAo5bzdvcjJWb1hWZTVyUnNoMms4dzV2TlVPL3BBdEk4VkRydUhCYzRxaHM3MDI1ZTZTUXFDeHUyOHNhTDh1blJQCkR6V2ZsNVpLcTVpdlJNeFQrcUo0UGpBL2pHV2d6QVliL1hDQXRrRVJyNlMwak9XaEw1Q0ErVU1BQmd5a1c5emQKTmlXbnJZUEdqVWh1WjZBeWJ1VzMxMjRqdlFvbndRRUprNEdoayt2SU53SURBUUFCb0FBd0RRWUpLb1pJaHZjTgpBUUVMQlFBRGdnRUJBQi94dDZ2d2EweWZHZFpKZ1k2ZDRUZEFtN2ZiTHRqUE15OHByTi9WZEdxN25oVDNUUE5zCjEwRFFaVGN6T21hTjVTZmpTaVAvaDRZQzQ0QjhFMll5Szg4Z2lDaUVEWDNlaDFYZnB3bnlJMVBDVE1mYys3cWUKMkJZTGJWSitRY040MDU4YituK24wMy9oVkN4L1VRRFhvc2w4Z2hOaHhGck9zRUtuVExiWHRsK29jQ0RtN3I3UwpUYTFkbWtFWCtWUnFJYXFGSDd1dDJveHgxcHdCdnJEeGUvV2cybXNqdHJZUXJ3eDJmQnErQ2Z1dm1sVS9rME4rCml3MEFjbVJsMy9veTdqR3ptMXdqdTJvNG4zSDNKQ25SbE41SnIyQkZTcFVQU3dCL1lUZ1ZobHVMNmwwRERxS3MKNTdYcEYxcjZWdmJmbTRldkhDNnJCSnNiZmI2ZU1KejZPMUU9Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=
signerName: kubernetes.io/kube-apiserver-client
usages:
- client auth

View File

@ -0,0 +1,22 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: node-admin
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "watch", "list", "create", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: davida-binding
subjects:
- kind: User
name: davida
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: node-admin
apiGroup: rbac.authorization.k8s.io

View File

@ -0,0 +1,24 @@
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: storage-admin
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "watch", "list", "create", "delete"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "watch", "list", "create", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: davida-storage-admin
subjects:
- kind: User
name: davida
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: storage-admin
apiGroup: rbac.authorization.k8s.io

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: back-end
spec:
type: ClusterIP
ports:
- targetPort: 80
port: 80
selector:
app: myapp
type: back-end

View File

@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
APP_COLOR: blue
APP_MODE: prod

View File

@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: monitoring-daemon
spec:
selector:
matchLabels:
app: monitoring-agent
template:
metadata:
labels:
app: monitoring-agent
spec:
containers:
- name: monitoring-agent
image: monitoring-agent

View File

@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: elasticsearch
spec:
selector:
matchLabels:
app: elastic-agent
template:
metadata:
labels:
app: elastic-agent
spec:
containers:
- name: elasticsearch-container
image: k8s.gcr.io/fluentd-elasticsearch:1.20

View File

@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: red
spec:
replicas: 2
selector:
matchLabels:
app: red
template:
metadata:
labels:
app: red
spec:
containers:
- image: nginx
name: nginx
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists

View File

@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: blue
spec:
replicas: 3
selector:
matchLabels:
app: blue
template:
metadata:
labels:
app: blue
spec:
containers:
- image: nginx
name: nginx
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: color
operator: In
values:
- blue

View File

@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2022-06-27T08:46:32Z"
generation: 2
labels:
app: myapp
type: front-end
name: myapp-deployment
namespace: default
resourceVersion: "33808"
uid: f67d009a-4fb9-4e99-84c8-45b968038b0b
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
type: front-end
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
app: myapp
type: front-end
name: myapp-pod
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx-container
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 3
conditions:
- lastTransitionTime: "2022-06-27T08:46:49Z"
lastUpdateTime: "2022-06-27T08:46:49Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2022-06-27T08:46:32Z"
lastUpdateTime: "2022-06-27T08:46:49Z"
message: ReplicaSet "myapp-deployment-689f9d59" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 2
readyReplicas: 3
replicas: 3
updatedReplicas: 3

View File

@ -0,0 +1,72 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# deployments.apps "myapp-deployment" was not valid:
# * <nil>: Invalid value: "The edited file failed validation": ValidationError(Deployment.spec.strategy.rollingUpdate): unknown field "mxUnavailable" in io.k8s.api.apps.v1.RollingUpdateDeployment
#
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2022-06-27T08:46:32Z"
generation: 2
labels:
app: myapp
type: front-end
name: myapp-deployment
namespace: default
resourceVersion: "33808"
uid: f67d009a-4fb9-4e99-84c8-45b968038b0b
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
type: front-end
strategy:
rollingUpdate:
maxSurge: 25%
mxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: myapp
type: front-end
name: myapp-pod
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx-container
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 3
conditions:
- lastTransitionTime: "2022-06-27T08:46:49Z"
lastUpdateTime: "2022-06-27T08:46:49Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
- lastTransitionTime: "2022-06-27T08:46:32Z"
lastUpdateTime: "2022-06-27T08:46:49Z"
message: ReplicaSet "myapp-deployment-689f9d59" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
observedGeneration: 2
readyReplicas: 3
replicas: 3
updatedReplicas: 3

View File

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment #wenn Deployment ausgehührt wird, wird automatich auch ReplicaSet erstellt
metadata:
name: myapp-deployment
labels:
app: myapp
type: front-end
spec:
template: # aus der Template werden die Pods erstellt
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx
replicas: 3
selector:
matchLabels:
type: front-end # es werden Replica des Pods erstellt, die das Label "front-end" beihaltet

View File

@ -0,0 +1,20 @@
# Erstellung eines Deployments mit dem webapp-color Kontainer und mit 3 Replicas
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp
spec:
template:
metadata:
name: web-app-color
labels:
app: mywebapp
type: front-end
spec:
containers:
- name: webapp-container
image: kodekloud/webapp-color
replicas: 3
selector:
matchLabels:
type: front-end

View File

@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-frontend
spec:
replicas: 3
selector:
matchLabels:
name: httpd-alpine-pod
template:
metadata:
labels:
name: httpd-alpine-pod
spec:
containers:
- name: httpd-alpine-container
image: httpd:2.4-alpine
command:
- sh
- "-c"
- echo Hello Kubernetes! && sleep 3600

View File

@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-dashboard
namespace: default
spec:
replicas: 1
selector:
matchLabels:
name: web-dashboard
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
name: web-dashboard
spec:
serviceAccountName: dashboard-sa
containers:
- image: gcr.io/kodekloud/customimage/my-kubernetes-dashboard
imagePullPolicy: Always
name: web-dashboard
ports:
- containerPort: 8080
protocol: TCP

View File

@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: developer
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["list","get","create","update","delete"]
- apiGroups: [""]
resources: ["ConfigMap"]
verbs: ["create"]

View File

@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: devuser-developer-binding
subjects:
- kind: User
name: dev-user
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: developer
apiGroup: rbac.authorization.k8s.io

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: event-simulator-pod
spec:
containers:
- name: event-simulator
image: kodekloud/event-simulator

342
Kubernetes/ktop Normal file
View File

@ -0,0 +1,342 @@
commit 4087e4aeebd5e03e31407750b938c0c6930f3ba7 (HEAD -> master, origin/master, origin/HEAD)
Author: David A <davidaster007@gmail.com>
Date: Wed Aug 31 09:31:26 2022 +0200
added state hamder into the ExpenseItem component
commit c71ce200e65a077dad7b82b29ebee253e5226c90
Author: David A <davidaster007@gmail.com>
Date: Wed Aug 31 06:36:44 2022 +0200
added the App with custom components
commit 4ec0fe027e109e8e1e7a7c0cfabdf42a98f091be
Author: David A <davidaster007@gmail.com>
Date: Fri Aug 19 13:19:45 2022 +0200
added fixed App
commit 55c0ecbedc2fb487404e396cefb0994fe99021d1
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 18 16:34:21 2022 +0200
added the ExpenseDate component, added styling for the ExpenseDate component
commit 8a10089c7e9583c19d014eeff39db961a16045df
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 18 16:05:21 2022 +0200
added reactJS app, from Javascript Object into reactJS template
commit a26f8c32cba90ddca853a95983cb26069e2e8202
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 18 08:49:46 2022 +0200
reactjs design of List application
commit 216f674111a53bfc122ed4ab7ee05e10402c037e
Author: David A <davidaster007@gmail.com>
Date: Fri Aug 12 10:55:37 2022 +0200
added reactjs Application, included default template of reactjs App
commit 24d9ed21668994addc8f24e8ef1b5ab911f756b5
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 11 14:55:55 2022 +0200
added zje whole chapter 2, from the react.js Course(refreshing the Pure Javascript)
commit efa5c08987ffb404dbc193c6b21109c2a3bda801
Author: David Aster <davidaster007@gmail.com>
Date: Thu Aug 11 09:08:31 2022 +0200
added first demo react.js app
commit 2aa2b7f19bb07f40eb3664dbf145f341076ca3b4
Author: David Aster <davidaster007@gmail.com>
Date: Wed Aug 10 16:24:40 2022 +0200
added sandbox.js
commit 4a5206bbee8f147afe8043bf7017501d23744c38
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 9 20:26:24 2022 +0200
added the chapter 15, working with noSQL database, and with google cloud platform (firebase server)
commit d341def40e3bafba8f9603ea2d53d1d49884132b
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 9 13:59:43 2022 +0200
modified app and forecast script. Added the Forecast class. Modified forecast funtionality with using the classes
commit fec331c97d33d9fe693df400cf76aa443eb393b1
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 9 10:27:41 2022 +0200
added prototyping into the User Class, added User and Admin class as function constructor
commit 06b1259e57ee88e9c2b934759666a2fdc05d2b82
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 9 08:53:29 2022 +0200
small change in comment
commit ebec5592cbb359eb7b58b109b38f3f1a5c0f4c0d
Author: David A <davidaster007@gmail.com>
Date: Mon Aug 8 22:07:17 2022 +0200
added the Chapter about an Object Oriented Javascript
commit 5cb8deec711ebb4c63fa9e63b983386e85bf4847
Author: David A <davidaster007@gmail.com>
Date: Mon Aug 8 14:13:59 2022 +0200
added locale storage funktionality into weather app, added locale Storage chapter
commit c69d13bba995738a48b18c9da55a6ce35e814db2
Author: David A <davidaster007@gmail.com>
Date: Fri Aug 5 22:26:04 2022 +0200
added chapter 12, getting weather data from AcuWeather API
commit 45772ce8e518fdbcdfc9d9141de6d8a9883ed222
Author: David A <davidaster007@gmail.com>
Date: Fri Aug 5 09:42:06 2022 +0200
added chapter 11
commit b7d209ef37cff1d4f840449fa9c6fae5a3160c3a
Author: David A <davidaster007@gmail.com>
Date: Fri Aug 5 07:54:30 2022 +0200
added chapter 10, working with date, timestamp and usage of dateFns Library
commit 694882b0c19be7cfeb0c1b622be9a67565d2d210
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 4 14:59:44 2022 +0200
added the whole chapter 9, to do application wit delete, create, search functionality
commit 73ca2bc71df808062a1fd15a595de308550d1660
Author: David A <davidaster007@gmail.com>
Date: Thu Aug 4 08:40:12 2022 +0200
modified styling
commit d23949c16a53999ca6f092479f9f5f9441edec00
Author: David A <davidaster007@gmail.com>
Date: Wed Aug 3 21:28:25 2022 +0200
added chapter 9, todo app
commit 5a8a6a67a36215dbfdb517b95b2f5673b46b5ade
Author: David A <davidaster007@gmail.com>
Date: Wed Aug 3 19:22:54 2022 +0200
completed the whole chapter 9
commit 7f1a4d308ba4f85bde265b38574a98d20e0844e5
Author: David Aster <davidaster007@gmail.com>
Date: Wed Aug 3 15:58:43 2022 +0200
added filter, find,reduce,map methods
commit 987080ad93d8aadc6c49eaa0c402446001dd04bc
Author: David Aster <davidaster007@gmail.com>
Date: Wed Aug 3 11:13:20 2022 +0200
chapter 8, added filter and map methods
commit 4aff0a9c03f961ea24593840ac414243bb1bca5c
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 2 15:00:48 2022 +0200
added the whole chapter 7
commit 1a8f5575faed80271b47bf705d523b3f72044766
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 2 12:21:43 2022 +0200
added form events
commit df354eda2408ab51d22c9ad35872eec362a4071f
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 2 09:44:45 2022 +0200
added chapters 01-06 from the Course "Modern Javascript"
commit 9b95eb3edb4fd36e1e364e99c437be2484951733
Author: David A <davidaster007@gmail.com>
Date: Tue Aug 2 09:37:57 2022 +0200
added javascript-react-js project
commit e01b908cf1dee0a543829a3820d3e49d4dc91056
Author: David A <davidaster007@gmail.com>
Date: Fri Jul 22 07:00:09 2022 +0200
added postgress with included helm functionality
commit bfa6372e8d0e985d26f2a29cc89db5567bbb7ad7
Author: David A <davidaster007@gmail.com>
Date: Thu Jul 21 20:18:37 2022 +0200
added deployment of postgress
commit f2c0478b84a57876b53c9b04f15a4aa2d79bc6f5
Author: David A <davidaster007@gmail.com>
Date: Thu Jul 21 09:07:07 2022 +0200
added a comment into helm/values.yaml, added a caddy-server configuration files
commit 75d072ca30c44d150f8dd2e59c6d28141608a8fe
Author: David Aster <davidaster007@gmail.com>
Date: Wed Jul 20 13:31:37 2022 +0200
added variables, to exclude with statement
commit 827e5a6dfb00e4ef0dc45f3d99542d8097bf4429
Author: David Aster <davidaster007@gmail.com>
Date: Wed Jul 20 12:43:07 2022 +0200
added range and with statements
commit a67258433545dc023a9980598052b99ca5bf0d13
Author: David A <davidaster007@gmail.com>
Date: Mon Jul 18 21:39:15 2022 +0200
added a Code from the helm Course Master Helm
commit cae4d5984af3577c1ed07d20c75c8bb24c0e0fc1
Author: David A <davidaster007@gmail.com>
Date: Thu Jul 14 09:43:26 2022 +0200
added full stack Istio application
commit 8f7d01275e2704d367c7bd80ceed1c9a0267ee58
Author: David A <davidaster007@gmail.com>
Date: Sun Jul 10 21:54:11 2022 +0200
added persistent volume claim definition, added persistent volume deinition
commit fff7c6474180f7c819d47db7aab4cbda983c4d4a
Author: David A <davidaster007@gmail.com>
Date: Sun Jul 10 20:57:20 2022 +0200
added Docker definition of alpine Image with random number generator, added pod definition wit random generator and with included volume
commit e36a6423cb7e3f0c6c762e8480f8b1d69b558df0
Author: David A <davidaster007@gmail.com>
Date: Thu Jul 7 21:11:27 2022 +0200
added deployment with service account, added network policy which allowed traffic from the API Pod from all namespaces
commit 3a7d7c10ce234d39c42a114542ec5588ed0f4db7
Author: David A <davidaster007@gmail.com>
Date: Thu Jul 7 09:23:16 2022 +0200
added ABAC Authorization, cluster role definition, develoepr role definition, rolebinding definition for dev-user
commit a4ef9895c66101150d33fb9422590c5cc1cc93dd
Author: David A <davidaster007@gmail.com>
Date: Tue Jul 5 21:09:14 2022 +0200
added kubeConfig definiton, kubeConf with namespaces and certifikates definitions
commit ec44ad3d78fa9f4acb389a3998261250820f3669
Author: David A <davidaster007@gmail.com>
Date: Tue Jul 5 20:12:30 2022 +0200
added Zertificates and CertificateSigningRequest object definition
commit e5dc53d477145f5ad9682c1c11d66fb5d3d7efc2
Merge: 8309676 f2195a6
Author: David A <davidaster007@gmail.com>
Date: Mon Jul 4 10:35:53 2022 +0200
Merge branch 'master' of https://github.com/SynTax64/Logbuch
commit 83096766485a99089b068eb69d8099e10a929c5a
Author: David A <davidaster007@gmail.com>
Date: Mon Jul 4 10:35:12 2022 +0200
add backup resources definiton, kube-aouserver security konfiguration, secret definition, static password definion, static token deifinition, pod definition with commands and arguments
commit f2195a6fdb103190402b78993338b791905661cc
Author: David Aster <davidaster007@gmail.com>
Date: Wed Jun 29 10:32:11 2022 +0200
added pod definition with init container
commit fff25d1051a898fc21ee64f14f49cf3dc6892708
Author: David Aster <davidaster007@gmail.com>
Date: Wed Jun 29 09:31:09 2022 +0200
removed superfluous File
commit 4a0af0f2146f8c9b4a64ae0a5c123ed7382c873b
Author: David Aster <davidaster007@gmail.com>
Date: Wed Jun 29 09:27:25 2022 +0200
renamed nodePort File
commit 105af8cbaf7a26da78053a705a1a3a191a89ac65
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 28 12:39:45 2022 +0200
added pod definiton with the multiple containers, added pod definition with secret reference
commit a3d5c7628827fdb049e3b92b2d9afcfb9a102065
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 28 08:50:34 2022 +0200
added ConfigMap app-config, added pod-definition with ConfigMap definition
commit 9f8169ca633a3011eb9dfb447dce5c6303f53e8e
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 28 08:07:18 2022 +0200
added definitons with recreate and RollingUpdate strategy definitons
commit b13fa2fb2d65cbe6e55de9bd4237108318bbfa27
Author: David A <davidaster007@gmail.com>
Date: Mon Jun 27 06:38:16 2022 +0200
added daemon set and replica set definition. what are differences between them
commit 5864de262601eb9a6bad48c67cfa1da5a92ae036
Author: David A <davidaster007@gmail.com>
Date: Fri Jun 24 07:56:12 2022 +0200
added deployment deifniton with node afinity, with toleratio, daemonset definiton
commit 468ae3b0a7c521bd838d16e17e02c77db824cea1
Author: David A <davidaster007@gmail.com>
Date: Thu Jun 23 09:51:03 2022 +0200
added pods with toleration definiton
commit 4b94c708d14411d4e3fd4ec9013a3747f8288241
Author: David A <davidaster007@gmail.com>
Date: Thu Jun 23 08:56:32 2022 +0200
added Pod definiton with the manual scheduler, added Pod definiton with toleration definition
commit 6148ed9d774dcb9d6edbd7e495ba999185e7f5a9
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 21 19:27:53 2022 +0200
added Cluster IP Definition, LoadBalancer Definition, NodePort Definition, Namespace Definiton, Pod Definiton with Namespace Definition, Resource Quota Definiton, Format of Pod Definition
commit 2a73644797fcf18c3e87b4ecdbd7eeee3c185e13
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 21 11:39:22 2022 +0200
added deployment with three httpd image replicas
commit 9a41da021f3553d2fc5cb1bc9f27e0d8afd0aa31
Author: David A <davidaster007@gmail.com>
Date: Tue Jun 21 11:08:54 2022 +0200
Beinhaltet die einfache Deployment-Definition, Replikation-Kontroller Definition, Replika-Set Definition, POD Definition mit einem nginx-Kontainer

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-apiserver
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
- --authorization-mode=Node,RBAC
<content-hidden>
- --basic-auth-file=/tmp/users/user-details.csv

View File

@ -0,0 +1,23 @@
apiVersion: v1
kind: Pod
metadata:
name: kube-apiserver
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
<content-hidden>
image: k8s.gcr.io/kube-apiserver-amd64:v1.11.3
name: kube-apiserver
volumeMounts:
- mountPath: /tmp/users
name: usr-details
readOnly: true
volumes:
- hostPath:
path: /tmp/users
type: DirectoryOrCreate
name: usr-details

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: Config
urrent-context: dev-user@google
clusters:
- name: my-kube-playground
- name: development
- name: production
- name: google
contexts:
- name: my-kube-admin@my-kube-playground
- name: dev-user@google
- name: prod-user@production
users:
- name: my-kube-admin
- name: admin
- name: dev-user
- name: prod-user

View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
certificate-authority: /etc/kubernetes/pki/ca.crt
server: https://172.17.0.51:6443
contexts:
- name: admin@production
context:
cluster: production
user: admin
namespace: finance
users:
- name: admin
user:
client-certificate: /etc/kubernetes/pki/users/admin.crt
client-key: /etc/kubernetes/pki/users/admin.key

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: Config
clusters:
- name: production
cluster:
certificate-authority: ca.crt
server: https://172.17.0.51:6443
contexts:
- name: admin@production
context:
cluster: production
user: admin
namespace: finance
users:
- name: admin
user:
client-certificate: admin.crt
client-key: admin.key

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
type: LoadBalancer
ports:
- targetPort: 80
port: 80
nodePort: 30008

View File

@ -0,0 +1,7 @@
#Namespace-Erstellung Mithilfe der YAML Definition or mit dem "kubectl create namespace dev" Befehl
apiVersion: v1
kind: Namespace
metadata:
name: dev
# Einstellung, dass das Dev-Namespace das ursprüngliche Namespace sein wird
# kubectl config set-context $(kubectl config current-context) --namespace=dev

View File

@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: db-policy
spec:
podSelector:
matchLabels:
role: db
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
name: api-pod
ports: - podSelector
- protocol: TCP
port: 3306

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
type: NodePort
ports:
- targetPort: 80
port: 80
nodePort: 30008
selector:
app: myapp
type: front-end

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myclaim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-vol1
spec:
accessModes:
- ReadWriteOnce: #Möglich drei Optionen: ReadOnlyMany|ReadWriteOnce|ReadWriteMany
capacity:
storage: 1Gi # (nicht Gigabyte(1024MB) :) sondern Gigibyte (1000MB))
hostPath:
path: /tmp/data

View File

@ -0,0 +1,13 @@
# Die einfache Pod-erstellung mit dem nginx Kontainer
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
namespace: dev # der Pod wird im Dev-Namespace erstellt
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: simple-webapp
labels:
name: simple-webapp
spec:
containers:
- name: simple-webapp
image: simple-webapp
ports:
- containerPort: 8080
- name: log-agent
image: log-agent

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
name: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 8080
nodeName: controlplane

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: ubuntu-sleeper
spec:
containers:
- name: ubuntu
image: ubuntu
command: ["sleep","5000"]

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: webapp-green
spec:
containers:
- name: simple-webapp
image: kodekloud/webapp.color
command: ["python","app.py"]
args: ["--color","pink"]

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: ubuntu-sleeper-1
spec:
containers:
- name: ubuntu
image: ubuntu
command: ["sleep","5000"]

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: simple-webapp
labels:
name: simple-webapp
spec:
containers:
- name: simple-webapp-container
image: simple-webapp-color
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: app-config # Die Reference auf die ConfigMap "app-config" 'pod-definition-with-config-map-variables-injection.yml'

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: red
spec:
containers:
- name: red-container
image: busybox:1.28
command: ["sh","-c","echo The app is running && sleep 3600"]
initContainers:
- name: busybox-container
image: busybox
command: ["sleep","20"]

View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: Pod
metadata:
name: random-number-generator
spec:
containers:
name: alpine
image: alpine
command: ["/bin/sh ","-c"]
args: ["shuf -i 1-100 -n 1 >> /opt/number.out"]
volumeMounts:
- mountPath: /opt
name: data-volume
volumes:
- name: data-volume
hostPath:
path: /data
type: Directory

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: webapp-pod
spec:
containers:
- name: webapp
image: kodekloud/simple-webapp-mysql
envFrom:
- secretRef:
name: db-secret

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
nodeSelector:
size: Large

View File

@ -0,0 +1,12 @@
# Die einfache Pod-erstellung mit dem nginx Kontainer
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
spec:
containers:
- name: myapp
image: <Image>
tolerations:
- key: "app"
operator: "Equal"
value: "blue"
effect: "NoSchedule" #drei Möglichkeiten verfügbar (NoSchedule|PreferNoSchedule|NoExecute)

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: bee
spec:
containers:
- name: bee-pod
image: nginx
tolerations:
- key: "spray"
operator: "Equal"
value: "mortein"
effect: "NoSchedule"

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: ReplicationController # der Vorgänger des ReplicaSets
metadata:
name: myapp-rc
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx
replicas: 3 # Mithilfe des ReplicationControllers werden die 3 Replica-Pods erstellt

View File

@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: monitoring-daemon
spec:
selector:
matchLabels:
app: monitoring-agent
template:
metadata:
labels:
app: monitoring-agent
spec:
- name: monitoring-agent
image: monitoring-agent

View File

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: ReplicaSet #erstellen einen Replication Controller, der drei Replicapods hat
metadata:
name: myapp
labels:
name: front-app
type: front-end
spec:
template:
metadata:
# Stellt den Pod dar
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx
replicas: 3
selector: # Auswahl, welcher Kontainer aus der Template wird beim Deployment erstellt
matchLabels:
type: front-end # alle Kontainer, die "label -> type" "front-end" haben, werden dabei berücksichtigt

View File

@ -0,0 +1,14 @@
#Resource Quota Definition, damit man Resourcen im Namespace limitieren kann
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-quota
namespace: dev
spec:
hard:
pods: "10"
requests.cpu: "4"
requests.memory: 5Gi
limits.cpu: "10"
limits.memory: "10Gi"

View File

@ -0,0 +1,25 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: read-pods
namespace: default
subjects:
- kind: User
name: user1
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: db-secret
data:
DB_Host: c3FsMDEK
DB_User: cm9vdAo=
DB_Password: cGFzc3dvcmQxMjMK

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-apiserver
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
- --authorization-mode=Node,RBAC
- --advertise-address=172.17.0.107
- --allow-privileged=true
- --enable-admission-plugins=NodeRestriction
- --enable-bootstrap-token-auth=true
image: k8s.gcr.io/kube-apiserver-amd64:v1.11.3
name: kube-apiserver

View File

@ -0,0 +1,7 @@
password123 user1 u0001
password123 user2 u0002
password123 user3 u0003
password123 user4 u0004
password123 user5 u0005
1 password123 user1 u0001
2 password123 user2 u0002
3 password123 user3 u0003
4 password123 user4 u0004
5 password123 user5 u0005

View File

@ -0,0 +1,6 @@
KpjCVbI7rCFAHYPkByTIzRb7gu1cUc4B user10 u0010 group1
rJjncHmvtXHc6MlWQddhtvNyyhgTdxSC user11 u0011 group1
mjpOFIEiFOkL9toikaRNtt59ePtczZSq user12 u0012 group2
PG41IXhs7QjqwWkmBkvgGT9glOyUqZij user13 u0013 group2
1 KpjCVbI7rCFAHYPkByTIzRb7gu1cUc4B user10 u0010 group1
2 rJjncHmvtXHc6MlWQddhtvNyyhgTdxSC user11 u0011 group1
3 mjpOFIEiFOkL9toikaRNtt59ePtczZSq user12 u0012 group2
4 PG41IXhs7QjqwWkmBkvgGT9glOyUqZij user13 u0013 group2

10
caddy-server/Caddyfile Normal file
View File

@ -0,0 +1,10 @@
localhost {
respond "Hello, world!"
}
localhost:2016 {
respond "Goodbye, world!"
}

View File

@ -0,0 +1,25 @@
curl localhost:2019/load \
-H "Content-Type: application/json" \
-d @- << EOF
{
"apps": {
"http": {
"servers": {
"hello": {
"listen": [":2015"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Hello, world!"
}]
}
]
}
}
}
}
}
EOF

View File

@ -0,0 +1,32 @@
{
"apps": {
"http": {
"servers": {
"hello": {
"listen": [":2015"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Hello, world!"
}]
}
]
},
"bye": {
"listen": [":2016"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Goodbye, world!"
}]
}
]
}
}
}
}
}

5
helm/Chart.yaml Normal file
View File

@ -0,0 +1,5 @@
apiVersion: v2
name: helmdeployment
description: A helm chart for K8s deployment
type: application
version: 0.1.1

View File

10
helm/templates/NOTES.txt Normal file
View File

@ -0,0 +1,10 @@
Welcome to Helm deployment.
Your release name should be {{.Release.Name}}.
Your chart name also be {{.Chart.Name}}.
To learn more, run:
helm status {{.Release.Name}}

View File

@ -0,0 +1,6 @@
{{- define "mycharts.labels"}}
labels:
generator: helm
deployedby: davida
data: {{now | htmlDate }}
{{- end}}

View File

@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- $replica := .Values.replicacount}}
{{- $image := .Values.imagenginx}}
{{- with .Values.service}}
app: {{.labels.app}}
name: {{.labels.app}}-deployment
spec:
replicas: {{$replica}}
selector:
matchLabels:
app: {{.labels.app}}
strategy: {}
template:
metadata:
labels:
app: {{.labels.app}}
spec:
containers:
- image: {{$image}}
name: {{.labels.app}}
imagePullPolicy: IfNoPresent
{{end}}

View File

@ -0,0 +1,13 @@
kind: {{.Values.type}} # die Variable "type" aus der helm/values.yaml Datei
{{- range $namespace:= .Values.namespace}}
apiVersion: v1
metadata:
name: {{$namespace.name}} # die Variable "name" aus der helm/values.yaml Datei
{{- end}}
labels:
name: {{.Values.labels.name}} # die Variable "labels/name" aus der helm/values.yaml Datei
newname: demo-b
newlabel: demo-c
newlabelv2: demo-d
newlabelv3: demo-e
{{- template "mycharts.labels"}} # die Schablone "mycharts.labels" aus der _helpers.tpl

15
helm/templates/pod.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: {{.Values.kind}}
metadata:
name: {{.Values.podname}}
spec:
containers:
- name: {{.Values.containername}}
image: {{.Values.image}}
volumeMounts:
- mountPath: /usr/share/nginx/html
name: nginx-path
volumes:
- name: nginx-path
configMap:
name: nginx-configmap

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
{{- with .Values.service}}
app: {{.labels.app}}
name: {{.labels.app}}-service
spec:
type: {{.type}}
ports:
- port: {{.port}}
protocol: {{.protocol}}
targetPort: {{.targetPort}}}
selector:
app: {{.labels.app}}
{{- end}}

24
helm/values.yaml Normal file
View File

@ -0,0 +1,24 @@
type: Namespace
namespace:
- name: firstnamespace # Das Feld meherer Namespaces, das bei der Erstellung der Namespaces
- name: secondnamespace # berücksichtigt wird
labels:
name: demo-a
kind: Pod
podname: nginx-helpmod
containername: nginx-container
image: "nginx:1.16.0"
configname: nginx-configmap
volume:
path: /usr/share/nginx/html
pathname: nginx-path
configname: nginx-configmap
service:
type: NodePort
labels:
app: nginx
port: 80
protocol: TCP
targetPort: 80
replicacount: 2
imagenginx: "nginx:1.16.0"

21
postgress/Chart.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: v2
name: postgress
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.16.0

9
postgress/postgress.yaml Normal file
View File

@ -0,0 +1,9 @@
#postgres:
# config:
# data:
- key: POSTGRES_DB
value: postgress
- key: POSTGRES_USER
value: shan
- key: POSTGRES_PASSWORD
value: secret

View File

View File

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "postgress.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "postgress.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "postgress.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "postgress.labels" -}}
helm.sh/chart: {{ include "postgress.chart" . }}
{{ include "postgress.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "postgress.selectorLabels" -}}
app.kubernetes.io/name: {{ include "postgress.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "postgress.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "postgress.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.postgres.config.name }}
labels:
group: {{ .Values.postgres.group }}
data:
{{- range .Values.postgres.config.data }}
{{ .key }}: {{ .value }}
{{- end}}

View File

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.postgres.name }}
labels:
app: {{ .Values.postgres.name }}
group: {{ .Values.postgres.group }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Values.postgres.name }}
template:
metadata:
labels:
app: {{ .Values.postgres.name }}
group: {{ .Values.postgres.group }}
spec:
volumes:
- name: {{ .Values.postgres.volume.name }}
persistentVolumeClaim:
claimName: {{ .Values.postgres.volume.pvc.name }}
containers:
- name: {{ .Values.postgres.name }}
image: {{ .Values.postgres.container.image }}
ports:
- containerPort: {{ .Values.postgres.container.port }}
envFrom:
- configMapRef:
name: {{ .Values.postgres.config.name }}
volumeMounts:
- name: {{ .Values.postgres.volume.name }}
mountPath: {{ .Values.postgres.volume.mountPath }}

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: {{ .Values.postgres.volume.kind }}
metadata:
name: {{ .Values.postgres.volume.pvc.name }}
spec:
accessModes:
- {{ .Values.postgres.volume.pvc.accessMode }}
resources:
requests:
storage: {{ .Values.postgres.volume.pvc.storage }}

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.postgres.name }}
labels:
group: {{ .Values.postgres.group }}
spec:
type: {{ .Values.postgres.service.type }}
selector:
app: {{ .Values.postgres.name }}
ports:
- port: {{ .Values.postgres.service.port }}
targetPort: {{ .Values.postgres.container.port }}

View File

30
postgress/values.yaml Normal file
View File

@ -0,0 +1,30 @@
replicaCount: 1
postgres:
name: postgres
group: db
container:
image: postgres:9.6-alpine
port: 5432
service:
type: ClusterIP
port: 5432
volume:
name: postgres-storage
kind: PersistentVolumeClaim
mountPath: /var/lib/postgresql/data
pvc:
name: postgres-persistent-volume-claim
accessMode: ReadWriteOnce
storage: 4Gi
config:
name: postgres-config
data:
# key: value
- key: shan
value: shan
- key: POSTGRES_DB
value: postgress
- key: POSTGRES_USER
value: shan
- key: POSTGRES_PASSWORD
value: secret