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.
À propos de l'auteur
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.
Parcourir par canal
Automatisation
Les dernières nouveautés en matière d'automatisation informatique pour les technologies, les équipes et les environnements
Intelligence artificielle
Actualité sur les plateformes qui permettent aux clients d'exécuter des charges de travail d'IA sur tout type d'environnement
Cloud hybride ouvert
Découvrez comment créer un avenir flexible grâce au cloud hybride
Sécurité
Les dernières actualités sur la façon dont nous réduisons les risques dans tous les environnements et technologies
Edge computing
Actualité sur les plateformes qui simplifient les opérations en périphérie
Infrastructure
Les dernières nouveautés sur la plateforme Linux d'entreprise leader au monde
Applications
À l’intérieur de nos solutions aux défis d’application les plus difficiles
Programmes originaux
Histoires passionnantes de créateurs et de leaders de technologies d'entreprise
Produits
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Services cloud
- Voir tous les produits
Outils
- Formation et certification
- Mon compte
- Assistance client
- Ressources développeurs
- Rechercher un partenaire
- Red Hat Ecosystem Catalog
- Calculateur de valeur Red Hat
- Documentation
Essayer, acheter et vendre
Communication
- Contacter le service commercial
- Contactez notre service clientèle
- Contacter le service de formation
- Réseaux sociaux
À propos de Red Hat
Premier éditeur mondial de solutions Open Source pour les entreprises, nous fournissons des technologies Linux, cloud, de conteneurs et Kubernetes. Nous proposons des solutions stables qui aident les entreprises à jongler avec les divers environnements et plateformes, du cœur du datacenter à la périphérie du réseau.
Sélectionner une langue
Red Hat legal and privacy links
- À propos de Red Hat
- Carrières
- Événements
- Bureaux
- Contacter Red Hat
- Lire le blog Red Hat
- Diversité, équité et inclusion
- Cool Stuff Store
- Red Hat Summit