Deployment` VS `DeploymentConfig` in OPenShift - unix1998/technical_notes GitHub Wiki

In OpenShift, both Deployment and DeploymentConfig are resources used for managing the deployment of applications, but they serve different purposes and have slightly different features.

Deployment

  • API Group: Deployment belongs to the standard Kubernetes API group (apps/v1).
  • Purpose: Manages the deployment and scaling of application pods.
  • Features:
    • Defines desired state of application pods (e.g., number of replicas).
    • Handles rolling updates and rollbacks.
    • Supports horizontal pod autoscaling (HPA).
  • Usage: Typically used for managing stateless applications.

DeploymentConfig

  • API Group: DeploymentConfig belongs to the OpenShift specific API group (apps.openshift.io/v1).
  • Purpose: Manages the deployment and scaling of applications with additional features specific to OpenShift.
  • Features:
    • All features of Deployment.
    • Adds additional features like triggers and deployment strategies.
    • Supports integration with ImageStreams for automatic image updates.
    • Provides more control over the deployment process with various strategies (e.g., rolling, recreate).
  • Usage: Often used for managing stateful applications and for more advanced deployment scenarios.

Key Differences

  1. API Group:

    • Deployment: Part of the standard Kubernetes API.
    • DeploymentConfig: Specific to OpenShift, extends Kubernetes functionality.
  2. Features:

    • Both resources handle the deployment and scaling of application pods.
    • DeploymentConfig adds additional features like triggers, deployment strategies, and integration with ImageStreams.
  3. Triggers:

    • DeploymentConfig allows defining triggers for automated deployment updates based on image changes, configuration changes, or manual actions.
    • Deployment triggers updates only when the deployment configuration changes.
  4. Rolling Updates:

    • Both resources support rolling updates, but DeploymentConfig provides more control over the update process with various strategies.
  5. Automatic Image Updates:

    • DeploymentConfig can automatically update to the latest image version from an ImageStream.
    • Deployment does not have native support for ImageStreams.

When to Use Each

  • Use Deployment:
    • For standard Kubernetes deployments.
    • When you don't need advanced deployment features specific to OpenShift.
  • Use DeploymentConfig:
    • For deployments on OpenShift clusters.
    • When you need additional features like triggers, deployment strategies, or integration with ImageStreams.
    • For managing stateful applications or more complex deployment scenarios.

Summary

While both Deployment and DeploymentConfig handle the deployment of applications in OpenShift, DeploymentConfig provides additional features specific to OpenShift, making it more suitable for advanced deployment scenarios and stateful applications. However, if you're working in a standard Kubernetes environment or don't need the extra features provided by DeploymentConfig, Deployment may suffice for managing your deployments.