I am using OpenShift 4.7 and I want to convert my OpenShift DeploymentConfigs to Kubernetes Deployments. Right now, I'm creating most of my applications with an OpenShift kind: Template
file. Do OpenShift Templates support Kubernetes Deployments or do I need to switch to another kind of tool if I want to use Kubernetes Deployments?
Because of the limited information around this, I just tried to convert it to see what would happen and I couldn't get it to work. If someone could shed light on this subject and where to find good examples of how to go from DeploymentConfigs to Deployments I think the internet and I would appreciate that.
One of my current OpenShift DeploymentConfigs looks like this within a Template file:
...
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
description: Defines how to deploy the database
template.alpha.openshift.io/wait-for-ready: 'true'
name: postgresql
spec:
replicas: 1
selector:
name: postgresql
strategy:
type: Recreate
template:
metadata:
labels:
name: postgresql
name: postgresql
spec:
containers:
- env:
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: ${NAME}
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: ${NAME}
- name: POSTGRESQL_DATABASE
value: ${DATABASE_NAME}
image: ' '
livenessProbe:
exec:
command:
- /usr/libexec/check-container
- --live
initialDelaySeconds: 120
timeoutSeconds: 10
name: postgresql
ports:
- containerPort: 5432
readinessProbe:
exec:
command:
- /usr/libexec/check-container
initialDelaySeconds: 5
timeoutSeconds: 1
resources:
limits:
memory: ${MEMORY_POSTGRESQL_LIMIT}
volumeMounts:
- mountPath: /var/lib/pgsql/data
name: postgresql-data
volumes:
- name: postgresql-data
persistentVolumeClaim:
claimName: postgresql
triggers:
- imageChangeParams:
automatic: true
containerNames:
- postgresql
from:
kind: ImageStreamTag
name: postgresql:${POSTGRESQL_VERSION}
namespace: ${NAMESPACE}
type: ImageChange
- type: ConfigChange
...