From 2c5c119731e3782f8097041d347e0459d3e0e44a Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Sun, 24 Jul 2022 21:17:23 -0500 Subject: [PATCH] additional resources --- CKA_Course/role-pod-reader.yaml | 9 ++ CKA_Course/rolebinding-sa-pod-reader.yaml | 13 ++ CKA_Course/sa-my-service-account.yaml | 5 + yelb/yelb-lb.yaml | 159 ++++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 CKA_Course/role-pod-reader.yaml create mode 100644 CKA_Course/rolebinding-sa-pod-reader.yaml create mode 100644 CKA_Course/sa-my-service-account.yaml create mode 100644 yelb/yelb-lb.yaml diff --git a/CKA_Course/role-pod-reader.yaml b/CKA_Course/role-pod-reader.yaml new file mode 100644 index 0000000..c9ea67b --- /dev/null +++ b/CKA_Course/role-pod-reader.yaml @@ -0,0 +1,9 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: cka + name: pod-reader +rules: +- apiGroups: [""] + resources: ["pods", "pods/log"] + verbs: ["get", "watch", "list"] diff --git a/CKA_Course/rolebinding-sa-pod-reader.yaml b/CKA_Course/rolebinding-sa-pod-reader.yaml new file mode 100644 index 0000000..e1913cf --- /dev/null +++ b/CKA_Course/rolebinding-sa-pod-reader.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: sa-pod-reader + namespace: cka +subjects: +- kind: ServiceAccount + name: my-serviceaccount + namespace: cka +roleRef: + kind: Role + name: pod-reader + apiGroup: rbac.authorization.k8s.io diff --git a/CKA_Course/sa-my-service-account.yaml b/CKA_Course/sa-my-service-account.yaml new file mode 100644 index 0000000..9f7ccb9 --- /dev/null +++ b/CKA_Course/sa-my-service-account.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: my-serviceaccount + namespace: cka diff --git a/yelb/yelb-lb.yaml b/yelb/yelb-lb.yaml new file mode 100644 index 0000000..df8af79 --- /dev/null +++ b/yelb/yelb-lb.yaml @@ -0,0 +1,159 @@ +# Minor modification from http://www.it20.info/2017/07/yelb-yet-another-sample-app/ for demo purposes +apiVersion: v1 +kind: Namespace +metadata: + name: yelb +--- +apiVersion: v1 +kind: Service +metadata: + name: redis-server + labels: + app: redis-server + tier: cache + namespace: yelb +spec: + type: ClusterIP + ports: + - port: 6379 + selector: + app: redis-server + tier: cache +--- +apiVersion: v1 +kind: Service +metadata: + name: yelb-db + labels: + app: yelb-db + tier: backenddb + namespace: yelb +spec: + type: ClusterIP + ports: + - port: 5432 + selector: + app: yelb-db + tier: backenddb +--- +apiVersion: v1 +kind: Service +metadata: + name: yelb-appserver + labels: + app: yelb-appserver + tier: middletier + namespace: yelb +spec: + type: ClusterIP + ports: + - port: 4567 + selector: + app: yelb-appserver + tier: middletier +--- +apiVersion: v1 +kind: Service +metadata: + name: yelb-ui + labels: + app: yelb-ui + tier: frontend + namespace: yelb +spec: + type: LoadBalancer + ports: + - port: 80 + protocol: TCP + targetPort: 80 + selector: + app: yelb-ui + tier: frontend +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: yelb-ui + namespace: yelb +spec: + selector: + matchLabels: + app: yelb-ui + replicas: 1 + template: + metadata: + labels: + app: yelb-ui + tier: frontend + spec: + containers: + - name: yelb-ui + image: mreferre/yelb-ui:0.6 + ports: + - containerPort: 80 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-server + namespace: yelb +spec: + selector: + matchLabels: + app: redis-server + replicas: 1 + template: + metadata: + labels: + app: redis-server + tier: cache + spec: + containers: + - name: redis-server + image: redis:4.0.2 + ports: + - containerPort: 6379 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: yelb-db + namespace: yelb +spec: + selector: + matchLabels: + app: yelb-db + replicas: 1 + template: + metadata: + labels: + app: yelb-db + tier: backenddb + spec: + containers: + - name: yelb-db + image: mreferre/yelb-db:0.5 + ports: + - containerPort: 5432 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: yelb-appserver + namespace: yelb +spec: + selector: + matchLabels: + app: yelb-appserver + replicas: 1 + template: + metadata: + labels: + app: yelb-appserver + tier: middletier + spec: + containers: + - name: yelb-appserver + image: mreferre/yelb-appserver:0.5 + ports: + - containerPort: 4567