When deploying applications to Red Hat OpenShift, it's useful to check the status and health of the components. First, I'll show you how deployments work, and then you can check out some health reports.

How OpenShift APIs are deployed

Red Hat OpenShift applications can be created using a container image hosted on a remote registry, a YAML file that specifies the resources to create, a builder image using the source code from your Git repository, a Dockerfile, and more.

[ You might also like: How I constructed an interactive OpenShift lecture for Red Hat Academy. ]

Depending on the method selected, a Deployment or DeploymentConfig API object may be used. OpenShift supports both Deployment objects and DeploymentConfig objects; however, Deployment objects are recommended unless you need a specific feature provided by DeploymentConfig objects.

In OpenShift, when creating applications from a YAML file, Deployment objects are preferred. When building applications from a Dockerfile or from source, a DeploymentConfig object will be created automatically by the oc new-app command.

When troubleshooting DeploymentConfig or Deployment APIs, focus on the states of the replicas and pods that are created. A DeploymentConfig creates a ReplicationController that manages pod lifecycles. In the same way, Deployment creates replicas that manage the pods.

MySQL deployment example

This example creates a MySQL database from an image hosted at registry.access.redhat.com:

oc new-app --docker-image=registry.access.redhat.com/rhscl/mysql-57-rhel7:latest --name=mydb -e MYSQL_USER=user1 -e MYSQL_PASSWORD=mypa55 -e MYSQL_DATABASE=testdb -e MYSQL_ROOT_PASSWORD=r00tpa55

[sysadmin@server ~]$ oc describe dc mydb
Name: mydb
Namespace: DEV
Created: 130 minutes ago
Labels: app=dev
...output omitted...
Deployment #1 (latest):
Name: mydb-1
Created: 15 minutes ago
Status: Complete
Replicas: 1 current / 1 desired
Selector: app=mydb,deployment=mydb-1,deploymentconfig=mydb
Labels: app=mydb,openshift.io/deployment-config.name=mydb
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
...output omitted...

From this, you can deduce the following:

  • Status: Complete - The DeploymentConfig completed successfully.
  • Replicas: 1 current / 1 desired - You wanted one pod to be created (desired) and one has been created successfully (current).
  • Pods status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed - There is one pod running with none failing, and that’s very important. Any failed pod needs to be investigated and fixed, as that will mean an unhealthy deployment.

PHP application deployment

This second example deploys a PHP application, and this is a description of the DeploymentConfig:

[sysadmin@server]$ oc describe dc/php-helloworld
Name: php-helloworld
Namespace: web
Created: 12 minutes ago
Labels: app=php-helloworld
Annotations: openshift.io/generated-by=OpenShiftNewApp
Latest Version: 1
Selector: app=php-helloworld,deploymentconfig=php-helloworld
Replicas: 1
Triggers: Config, Image(php-helloworld@latest, auto=true)
Strategy: Rolling
Template:
Labels: app=php-helloworld
deploymentconfig=php-helloworld
...output omitted...
Containers:
php-helloworld:
Image: image-registry.openshift-image-registry.svc:5000/s2i/phphelloworld@
sha256:6d27...b983
Ports: 8080/TCP, 8443/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Deployment #1 (latest):
Name: php-helloworld-1
Created: 5 minutes ago
Status: Complete
Replicas: 3 current / 5 desired
Selector: app=php-helloworld,deployment=php-helloworld-1,deploymentconfig=phphelloworld
Labels: app=php-helloworld,openshift.io/deployment-config.name=php-helloworld
Pods Status: 3 Running / 0 Waiting / 0 Succeeded / 2 Failed
...output omitted...

As you can see, there are two failed pods. This indicates the deployment is not healthy and needs to be investigated. Administrators can view logs from the individual pods and apply the appropriate fix.

[ Learn the basics of using Kubernetes in this free cheat sheet. ] 

Wrap up

When troubleshooting deployments, it’s always important to look out for the pod's status, the number of replicas desired, and how many are currently running. Such information can make troubleshooting easier and more efficient.


저자 소개

I work as Unix/Linux Administrator with a passion for high availability systems and clusters. I am a student of performance and optimization of systems and DevOps. I have passion for anything IT related and most importantly automation, high availability, and security.

UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Virtualization icon

가상화

온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래