Skip to content

OpenShift Deployment Guide

Prerequisites

Before deploying to OpenShift, ensure you have:

  • OpenShift CLI (oc) installed
  • Access to an OpenShift cluster
  • Helm 3.x installed

Cluster Setup

  1. Login to OpenShift:
bash
oc login --token=sha256~... --server=https://api.cluster.example.com:6443
  1. Create a project:
bash
oc new-project prime-edm

Installing Prime EDM Charts

  1. Add the Helm repository:
bash
helm repo add prime-edm https://charts.acx-sandbox.net --username $USER --password $PASSWORD
helm repo update
  1. Create OpenShift-specific values:
yaml
# openshift-values.yaml
global:
  provider: openshift

security:
  securityContext:
    enabled: false
  
serviceAccount:
  annotations:
    serviceaccounts.openshift.io/oauth-redirectreference.primary: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"prime-edm"}}'

route:
  enabled: true
  tls:
    termination: edge
  1. Install the chart:
bash
helm install prime-edm prime-edm/prime-edm -f openshift-values.yaml

OpenShift-Specific Configuration

Storage Classes

OpenShift provides several storage options:

yaml
storage:
  # Default storage class
  class: managed-nfs-storage
  
  # Block storage
  # class: managed-block-storage

Routes

Using OpenShift Routes instead of Ingress:

yaml
route:
  enabled: true
  host: prime-edm.apps.cluster.example.com
  tls:
    termination: edge
    insecureEdgeTerminationPolicy: Redirect

Security Context Constraints

Configure SCCs:

yaml
securityContext:
  enabled: false
  fsGroup: null
  runAsUser: null

Secrets Management

Vault Operator Setup

  1. Install the Vault Operator:
bash
oc new-project hashicorp
oc apply -f https://raw.githubusercontent.com/hashicorp/vault-helm/main/operator/deploy/crds.yaml
oc apply -f https://raw.githubusercontent.com/hashicorp/vault-helm/main/operator/deploy/operator.yaml
  1. Deploy Vault:
bash
helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo update

helm install vault hashicorp/vault \
  --namespace hashicorp \
  --set "server.dev.enabled=true"
  1. Install External Secrets Operator:
bash
helm repo add external-secrets https://charts.external-secrets.io
helm repo update

helm install external-secrets \
  external-secrets/external-secrets \
  --namespace external-secrets \
  --create-namespace \
  --set installCRDs=true
  1. Create SecretStore:
yaml
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: vault-backend
spec:
  provider:
    vault:
      server: "http://vault.hashicorp:8200"
      path: "secret"
      version: "v2"
      auth:
        kubernetes:
          mountPath: "kubernetes"
          role: "prime-edm-role"
          serviceAccountRef:
            name: "prime-edm-sa"
  1. Create ExternalSecret:
yaml
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: database-secret
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: vault-backend
    kind: SecretStore
  target:
    name: db-credentials
  data:
  - secretKey: username
    remoteRef:
      key: database/credentials
      property: username
  - secretKey: password
    remoteRef:
      key: database/credentials
      property: password

Monitoring

OpenShift Monitoring Integration

Enable cluster monitoring:

yaml
monitoring:
  serviceMonitor:
    enabled: true
    namespace: openshift-monitoring

Best Practices

  1. Use node selectors:
yaml
nodeSelector:
  node-role.kubernetes.io/worker: ""
  1. Configure resource limits:
yaml
resources:
  requests:
    cpu: 250m
    memory: 512Mi
  limits:
    cpu: 500m
    memory: 1Gi
  1. Enable auto-scaling:
yaml
autoscaling:
  enabled: true
  minReplicas: 2
  maxReplicas: 10
  targetCPUUtilizationPercentage: 80

Troubleshooting

Common issues and solutions:

  1. Route issues:

    • Check route configuration
    • Verify TLS settings
    • Validate DNS setup
  2. Storage problems:

    • Confirm storage class exists
    • Check PVC status
    • Verify project quotas
  3. Security issues:

    • Check SCC assignments
    • Verify service account permissions
    • Validate role bindings

Released under the MIT License.