Added Openshift example deployments

This commit is contained in:
Armin Kunaschik
2023-05-22 01:11:41 +02:00
parent 3e2a051cb2
commit b79285b4fb
17 changed files with 486 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
application: kube-ops-view
component: frontend
name: kube-ops-view
spec:
replicas: 1
selector:
matchLabels:
application: kube-ops-view
component: frontend
template:
metadata:
labels:
application: kube-ops-view
component: frontend
spec:
serviceAccountName: kube-ops-view
containers:
- name: service
# see https://github.com/hjacobs/kube-ops-view/releases
image: hjacobs/kube-ops-view:23.5.0
args:
# remove this option to use built-in memory store
- --redis-url=redis://kube-ops-view-redis:6379
# example to add external links for nodes and pods
# - --node-link-url-template=https://kube-web-view.example.org/clusters/{cluster}/nodes/{name}
# - --pod-link-url-template=https://kube-web-view.example.org/clusters/{cluster}/namespaces/{namespace}/pods/{name}
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 5
resources:
limits:
cpu: 750m
memory: 512Mi
requests:
cpu: 500m
memory: 512Mi
securityContext:
readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- deployment.yaml
- rbac.yaml
- service.yaml
- redis-deployment.yaml
- redis-service.yaml
- route.yaml

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/node-selector: "node-role.kubernetes.io/infra=true"
name: ocp-ops-view

View File

@@ -0,0 +1,36 @@
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.primary: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"proxy"}}'
name: kube-ops-view
namespace: ocp-ops-view
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kube-ops-view
rules:
- apiGroups: [""]
resources: ["nodes", "pods"]
verbs:
- list
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes", "pods"]
verbs:
- get
- list
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kube-ops-view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kube-ops-view
subjects:
- kind: ServiceAccount
name: kube-ops-view
namespace: ocp-ops-view

View File

@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
application: kube-ops-view
component: redis
name: kube-ops-view-redis
spec:
replicas: 1
selector:
matchLabels:
application: kube-ops-view
component: redis
template:
metadata:
labels:
application: kube-ops-view
component: redis
spec:
containers:
- name: redis
image: redis:7-alpine
ports:
- containerPort: 6379
protocol: TCP
readinessProbe:
tcpSocket:
port: 6379
resources:
limits:
cpu: 200m
memory: 300Mi
requests:
cpu: 100m
memory: 300Mi
securityContext:
readOnlyRootFilesystem: true
# runAsNonRoot: true
# we need to use the "redis" uid
# runAsUser: 999
volumeMounts:
- name: redis-data
mountPath: /data
volumes:
- name: redis-data
emptyDir: {}
# defaultMode: 0775

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
application: kube-ops-view
component: redis
name: kube-ops-view-redis
spec:
selector:
application: kube-ops-view
component: redis
type: ClusterIP
ports:
- port: 6379
protocol: TCP
targetPort: 6379

View File

@@ -0,0 +1,14 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: proxy
spec:
host: ocp-ops-view.apps.<cluster.domain>
port:
targetPort: 8080
to:
kind: Service
name: kube-ops-view
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
labels:
application: kube-ops-view
component: frontend
name: kube-ops-view
spec:
selector:
application: kube-ops-view
component: frontend
type: ClusterIP
ports:
- port: 8080
protocol: TCP
targetPort: 8080