Skip to content

Instantly share code, notes, and snippets.

@dmc5179
Created April 29, 2021 16:43
Show Gist options
  • Save dmc5179/406712bfc4ec2164bfe3257223bef985 to your computer and use it in GitHub Desktop.
Save dmc5179/406712bfc4ec2164bfe3257223bef985 to your computer and use it in GitHub Desktop.
Example OpenShift 4 Deployment of an Apache HTTPD server
#---
#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
# name: httpd-pv-claim
# labels:
# app: httpd-frontend
#spec:
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: 10Gi
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: httpd-frontend
labels:
app: httpd-frontend
spec:
replicas: 1
selector:
matchLabels:
app: httpd-frontend
strategy:
type: RollingUpdate
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 120
maxSurge: "20%"
maxUnavailable: "10%"
pre: {}
post: {}
template:
metadata:
labels:
app: httpd-frontend
spec:
containers:
- image: registry.redhat.io/rhel8/httpd-24
imagePullPolicy: Always
name: httpd-rhel7
ports:
- containerPort: 8080
name: http-port
- containerPort: 8443
name: https-port
# volumeMounts:
# - name: httpd-persistent-storage
# mountPath: /home/httpd-server
# volumes:
# - name: httpd-persistent-storage
# persistentVolumeClaim:
# claimName: httpd-pv-claim
---
apiVersion: v1
kind: Service
metadata:
name: http-port
labels:
app: httpd-frontend
spec:
ports:
- port: 8080
name: http-port
protocol: TCP
targetPort: 8080
selector:
app: httpd-frontend
---
apiVersion: v1
kind: Service
metadata:
name: https-port
labels:
app: httpd-frontend
spec:
ports:
- port: 8443
name: https-port
protocol: TCP
targetPort: 8443
selector:
app: httpd-frontend
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: httpd-frontend
managedFields:
name: http-port
spec:
port:
targetPort: http-port
to:
kind: Service
name: http-port
weight: 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment