2.7. Commande OpenShift CLI Référence de commande
Cette référence fournit des descriptions et des exemples de commandes pour les commandes d’administrateur OpenShift CLI (oc). Il faut avoir des autorisations de cluster-admin ou des autorisations équivalentes pour utiliser ces commandes.
Dans le cas des commandes de développeurs, consultez la référence des commandes de développeurs OpenShift CLI.
Exécutez oc adm -h pour énumérer toutes les commandes d’administrateur ou exécuter oc <command> --aider à obtenir des détails supplémentaires pour une commande spécifique.
2.7.1. Commandes d’administrateur OpenShift CLI (oc) Copier lienLien copié sur presse-papiers!
2.7.1.1. ajouter au panier OC adm build-chain Copier lienLien copié sur presse-papiers!
Extrayez les entrées et les dépendances de vos builds
Exemple d’utilisation
# Build the dependency tree for the 'latest' tag in <image-stream>
oc adm build-chain <image-stream>
# Build the dependency tree for the 'v2' tag in dot format and visualize it via the dot utility
oc adm build-chain <image-stream>:v2 -o dot | dot -T svg -o deps.svg
# Build the dependency tree across all namespaces for the specified image stream tag found in the 'test' namespace
oc adm build-chain <image-stream> -n test --all
2.7.1.2. catalogue OC adm miroir Copier lienLien copié sur presse-papiers!
Afficher un catalogue d’opérateur-registre
Exemple d’utilisation
# Mirror an operator-registry image and its contents to a registry
oc adm catalog mirror quay.io/my/image:latest myregistry.com
# Mirror an operator-registry image and its contents to a particular namespace in a registry
oc adm catalog mirror quay.io/my/image:latest myregistry.com/my-namespace
# Mirror to an airgapped registry by first mirroring to files
oc adm catalog mirror quay.io/my/image:latest file:///local/index
oc adm catalog mirror file:///local/index/my/image:latest my-airgapped-registry.com
# Configure a cluster to use a mirrored registry
oc apply -f manifests/imageDigestMirrorSet.yaml
# Edit the mirroring mappings and mirror with "oc image mirror" manually
oc adm catalog mirror --manifests-only quay.io/my/image:latest myregistry.com
oc image mirror -f manifests/mapping.txt
# Delete all ImageDigestMirrorSets generated by oc adm catalog mirror
oc delete imagedigestmirrorset -l operators.openshift.org/catalog=true
2.7.1.3. le certificat OC adm approuve Copier lienLien copié sur presse-papiers!
Approuver une demande de signature de certificat
Exemple d’utilisation
# Approve CSR 'csr-sqgzp'
oc adm certificate approve csr-sqgzp
2.7.1.4. certificat OC adm refusant Copier lienLien copié sur presse-papiers!
Refuser une demande de signature de certificat
Exemple d’utilisation
# Deny CSR 'csr-sqgzp'
oc adm certificate deny csr-sqgzp
2.7.1.5. copier-to-node d’OC adm Copier lienLien copié sur presse-papiers!
Copiez les fichiers spécifiés dans le nœud
Exemple d’utilisation
# Copy a new bootstrap kubeconfig file to node-0
oc adm copy-to-node --copy=new-bootstrap-kubeconfig=/etc/kubernetes/kubeconfig node/node-0
2.7.1.6. ajouter au panier OC adm cordon Copier lienLien copié sur presse-papiers!
Nœud de marque comme imprévu
Exemple d’utilisation
# Mark node "foo" as unschedulable
oc adm cordon foo
2.7.1.7. création-bootstrap-project-template d’OC adm Copier lienLien copié sur presse-papiers!
Créer un modèle de projet bootstrap
Exemple d’utilisation
# Output a bootstrap project template in YAML format to stdout
oc adm create-bootstrap-project-template -o yaml
2.7.1.8. création-erreur-template d’OC adm Copier lienLien copié sur presse-papiers!
Créer un modèle de page d’erreur
Exemple d’utilisation
# Output a template for the error page to stdout
oc adm create-error-template
2.7.1.9. ajouter au panier OC adm create-login-template Copier lienLien copié sur presse-papiers!
Créer un modèle de connexion
Exemple d’utilisation
# Output a template for the login page to stdout
oc adm create-login-template
2.7.1.10. création-fournisseur-sélection-template OC adm Copier lienLien copié sur presse-papiers!
Créer un modèle de sélection du fournisseur
Exemple d’utilisation
# Output a template for the provider selection page to stdout
oc adm create-provider-selection-template
2.7.1.11. drain d’adm OC Copier lienLien copié sur presse-papiers!
Nœud de vidange en préparation à l’entretien
Exemple d’utilisation
# Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set on it
oc adm drain foo --force
# As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set, and use a grace period of 15 minutes
oc adm drain foo --grace-period=900
2.7.1.12. groupes d’adm OC add-users Copier lienLien copié sur presse-papiers!
Ajouter des utilisateurs à un groupe
Exemple d’utilisation
# Add user1 and user2 to my-group
oc adm groups add-users my-group user1 user2
2.7.1.13. les groupes d’adm OC nouveaux Copier lienLien copié sur presse-papiers!
Créer un nouveau groupe
Exemple d’utilisation
# Add a group with no users
oc adm groups new my-group
# Add a group with two users
oc adm groups new my-group user1 user2
# Add a group with one user and shorter output
oc adm groups new my-group user1 -o name
2.7.1.14. groupes d’adm OC prunes Copier lienLien copié sur presse-papiers!
Enlever les anciens groupes OpenShift faisant référence aux enregistrements manquants d’un fournisseur externe
Exemple d’utilisation
# Prune all orphaned groups
oc adm groups prune --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups except the ones from the denylist file
oc adm groups prune --blacklist=/path/to/denylist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in an allowlist file
oc adm groups prune --whitelist=/path/to/allowlist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in a list
oc adm groups prune groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
2.7.1.15. les groupes d’adm OC suppriment les utilisateurs Copier lienLien copié sur presse-papiers!
Enlever les utilisateurs d’un groupe
Exemple d’utilisation
# Remove user1 and user2 from my-group
oc adm groups remove-users my-group user1 user2
2.7.1.16. les groupes d’adm OC se synchronisent Copier lienLien copié sur presse-papiers!
Synchroniser les groupes OpenShift avec les enregistrements d’un fournisseur externe
Exemple d’utilisation
# Sync all groups with an LDAP server
oc adm groups sync --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync all groups except the ones from the blacklist file with an LDAP server
oc adm groups sync --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync specific groups specified in an allowlist file with an LDAP server
oc adm groups sync --whitelist=/path/to/allowlist.txt --sync-config=/path/to/sync-config.yaml --confirm
# Sync all OpenShift groups that have been synced previously with an LDAP server
oc adm groups sync --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Sync specific OpenShift groups if they have been synced previously with an LDAP server
oc adm groups sync groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm
2.7.1.17. inspection d’OC adm Copier lienLien copié sur presse-papiers!
Collecter des données de débogage pour une ressource donnée
Exemple d’utilisation
# Collect debugging data for the "openshift-apiserver" clusteroperator
oc adm inspect clusteroperator/openshift-apiserver
# Collect debugging data for the "openshift-apiserver" and "kube-apiserver" clusteroperators
oc adm inspect clusteroperator/openshift-apiserver clusteroperator/kube-apiserver
# Collect debugging data for all clusteroperators
oc adm inspect clusteroperator
# Collect debugging data for all clusteroperators and clusterversions
oc adm inspect clusteroperators,clusterversions
2.7.1.18. ajouter au panier OC adm migration icsp Copier lienLien copié sur presse-papiers!
Actualiser le(s) fichier(s) imagecontentsourcepolicy(s) vers imagedigestmirrorset fichier(s)
Exemple d’utilisation
# Update the imagecontentsourcepolicy.yaml file to a new imagedigestmirrorset file under the mydir directory
oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
2.7.1.19. annonces OC migration template-instances Copier lienLien copié sur presse-papiers!
Actualisez les instances de modèle pour pointer vers les dernières versions de groupe-types
Exemple d’utilisation
# Perform a dry-run of updating all objects
oc adm migrate template-instances
# To actually perform the update, the confirm flag must be appended
oc adm migrate template-instances --confirm
2.7.1.20. ajouter au panier OC adm must-collectther Copier lienLien copié sur presse-papiers!
Lancer une nouvelle instance d’un pod pour recueillir des informations de débogage
Exemple d’utilisation
# Gather information using the default plug-in image and command, writing into ./must-gather.local.<rand>
oc adm must-gather
# Gather information with a specific local folder to copy to
oc adm must-gather --dest-dir=/local/directory
# Gather audit information
oc adm must-gather -- /usr/bin/gather_audit_logs
# Gather information using multiple plug-in images
oc adm must-gather --image=quay.io/kubevirt/must-gather --image=quay.io/openshift/origin-must-gather
# Gather information using a specific image stream plug-in
oc adm must-gather --image-stream=openshift/must-gather:latest
# Gather information using a specific image, command, and pod directory
oc adm must-gather --image=my/image:tag --source-dir=/pod/directory -- myspecial-command.sh
2.7.1.21. le nouveau projet OC adm Copier lienLien copié sur presse-papiers!
Créer un nouveau projet
Exemple d’utilisation
# Create a new project using a node selector
oc adm new-project myproject --node-selector='type=user-node,region=east'
2.7.1.22. création d’une image de nœud d’adm OC Copier lienLien copié sur presse-papiers!
Créer une image ISO pour démarrer les nœuds à ajouter au cluster cible
Exemple d’utilisation
# Create the ISO image and download it in the current folder
oc adm node-image create
# Use a different assets folder
oc adm node-image create --dir=/tmp/assets
# Specify a custom image name
oc adm node-image create -o=my-node.iso
# Create an ISO to add a single node without using the configuration file
oc adm node-image create --mac-address=00:d8:e7:c7:4b:bb
# Create an ISO to add a single node with a root device hint and without
# using the configuration file
oc adm node-image create --mac-address=00:d8:e7:c7:4b:bb --root-device-hint=deviceName:/dev/sda
2.7.1.23. contrôleur d’image de nœud d’adm OC Copier lienLien copié sur presse-papiers!
Contrôlez de nouveaux nœuds ajoutés à un cluster OpenShift
Exemple d’utilisation
# Monitor a single node being added to a cluster
oc adm node-image monitor --ip-addresses 192.168.111.83
# Monitor multiple nodes being added to a cluster by separating each
IP address with a comma
oc adm node-image monitor --ip-addresses 192.168.111.83,192.168.111.84
2.7.1.24. carnets de nœuds d’adm OC Copier lienLien copié sur presse-papiers!
Afficher et filtrer les journaux des nœuds
Exemple d’utilisation
# Show kubelet logs from all control plane nodes
oc adm node-logs --role master -u kubelet
# See what logs are available in control plane nodes in /var/log
oc adm node-logs --role master --path=/
# Display cron log file from all control plane nodes
oc adm node-logs --role master --path=cron
2.7.1.25. certificats OC adm ocp-certificats moniteurs Copier lienLien copié sur presse-papiers!
Certificats de plate-forme de surveillance
Exemple d’utilisation
# Watch platform certificates
oc adm ocp-certificates monitor-certificates
2.7.1.26. certificats OC adm ocp-regenerate-feuille Copier lienLien copié sur presse-papiers!
Régénérer le client et servir les certificats d’un cluster OpenShift
Exemple d’utilisation
# Regenerate a leaf certificate contained in a particular secret
oc adm ocp-certificates regenerate-leaf -n openshift-config-managed secret/kube-controller-manager-client-cert-key
2.7.1.27. ocp-certificates OC adm regenerate-machine-config-server-serving-cert Copier lienLien copié sur presse-papiers!
Générez les certificats d’opérateur de configuration de la machine dans un cluster OpenShift
Exemple d’utilisation
# Regenerate the MCO certs without modifying user-data secrets
oc adm ocp-certificates regenerate-machine-config-server-serving-cert --update-ignition=false
# Update the user-data secrets to use new MCS certs
oc adm ocp-certificates update-ignition-ca-bundle-for-machine-config-server
2.7.1.28. les certificats OC adm ocp se régénérent en haut niveau Copier lienLien copié sur presse-papiers!
Générez les certificats de niveau supérieur dans un cluster OpenShift
Exemple d’utilisation
# Regenerate the signing certificate contained in a particular secret
oc adm ocp-certificates regenerate-top-level -n openshift-kube-apiserver-operator secret/loadbalancer-serving-signer-key
2.7.1.29. les certificats OC adm ocp éliminent la confiance Copier lienLien copié sur presse-papiers!
Enlever les anciennes CA de ConfigMaps représentant les paquets de confiance de la plate-forme dans un cluster OpenShift
Exemple d’utilisation
# Remove a trust bundled contained in a particular config map
oc adm ocp-certificates remove-old-trust -n openshift-config-managed configmaps/kube-apiserver-aggregator-client-ca --created-before 2023-06-05T14:44:06Z
# Remove only CA certificates created before a certain date from all trust bundles
oc adm ocp-certificates remove-old-trust configmaps -A --all --created-before 2023-06-05T14:44:06Z
2.7.1.30. l’OC adm ocp-certificates met à jour-ignition-ca-bundle-for-machine-config-server Copier lienLien copié sur presse-papiers!
Actualisez les secrets des données utilisateur dans un cluster OpenShift pour utiliser les certificats MCO mis à jour
Exemple d’utilisation
# Regenerate the MCO certs without modifying user-data secrets
oc adm ocp-certificates regenerate-machine-config-server-serving-cert --update-ignition=false
# Update the user-data secrets to use new MCS certs
oc adm ocp-certificates update-ignition-ca-bundle-for-machine-config-server
2.7.1.31. adm pod-réseau-isolats-projets OC adm pod-network Copier lienLien copié sur presse-papiers!
Isoler le réseau de projet
Exemple d’utilisation
# Provide isolation for project p1
oc adm pod-network isolate-projects <p1>
# Allow all projects with label name=top-secret to have their own isolated project network
oc adm pod-network isolate-projects --selector='name=top-secret'
2.7.1.32. co-projets OC adm pod-network Copier lienLien copié sur presse-papiers!
Joignez-vous au réseau de projets
Exemple d’utilisation
# Allow project p2 to use project p1 network
oc adm pod-network join-projects --to=<p1> <p2>
# Allow all projects with label name=top-secret to use project p1 network
oc adm pod-network join-projects --to=<p1> --selector='name=top-secret'
2.7.1.33. adm pod-network make-projects-global Copier lienLien copié sur presse-papiers!
Faire du réseau de projets global
Exemple d’utilisation
# Allow project p1 to access all pods in the cluster and vice versa
oc adm pod-network make-projects-global <p1>
# Allow all projects with label name=share to access all pods in the cluster and vice versa
oc adm pod-network make-projects-global --selector='name=share'
2.7.1.34. adm politique d’OC add-cluster-role-to-groupe Copier lienLien copié sur presse-papiers!
Ajouter un rôle aux groupes pour tous les projets du cluster
Exemple d’utilisation
# Add the 'cluster-admin' cluster role to the 'cluster-admins' group
oc adm policy add-cluster-role-to-group cluster-admin cluster-admins
2.7.1.35. adm politique d’OC add-cluster-role-to-user Copier lienLien copié sur presse-papiers!
Ajouter un rôle aux utilisateurs pour tous les projets du cluster
Exemple d’utilisation
# Add the 'system:build-strategy-docker' cluster role to the 'devuser' user
oc adm policy add-cluster-role-to-user system:build-strategy-docker devuser
2.7.1.36. add-role-to-user de la politique d’adm OC Copier lienLien copié sur presse-papiers!
Ajouter un rôle aux utilisateurs ou aux comptes de service pour le projet en cours
Exemple d’utilisation
# Add the 'view' role to user1 for the current project
oc adm policy add-role-to-user view user1
# Add the 'edit' role to serviceaccount1 for the current project
oc adm policy add-role-to-user edit -z serviceaccount1
2.7.1.37. adm policy add-scc-to-group d’OC Copier lienLien copié sur presse-papiers!
Ajouter une contrainte de contexte de sécurité aux groupes
Exemple d’utilisation
# Add the 'restricted' security context constraint to group1 and group2
oc adm policy add-scc-to-group restricted group1 group2
2.7.1.38. adm policy add-scc-to-user Copier lienLien copié sur presse-papiers!
Ajouter une contrainte de contexte de sécurité aux utilisateurs ou à un compte de service
Exemple d’utilisation
# Add the 'restricted' security context constraint to user1 and user2
oc adm policy add-scc-to-user restricted user1 user2
# Add the 'privileged' security context constraint to serviceaccount1 in the current namespace
oc adm policy add-scc-to-user privileged -z serviceaccount1
2.7.1.39. la politique d’OC adm supprime-cluster-role-du-groupe Copier lienLien copié sur presse-papiers!
Enlever un rôle des groupes pour tous les projets du cluster
Exemple d’utilisation
# Remove the 'cluster-admin' cluster role from the 'cluster-admins' group
oc adm policy remove-cluster-role-from-group cluster-admin cluster-admins
2.7.1.40. la politique d’OC adm Remove-cluster-role-de-l’utilisateur Copier lienLien copié sur presse-papiers!
Enlever un rôle des utilisateurs pour tous les projets du cluster
Exemple d’utilisation
# Remove the 'system:build-strategy-docker' cluster role from the 'devuser' user
oc adm policy remove-cluster-role-from-user system:build-strategy-docker devuser
2.7.1.41. avis sur la politique d’OC adm Copier lienLien copié sur presse-papiers!
Vérifiez quel compte de service peut créer un pod
Exemple d’utilisation
# Check whether service accounts sa1 and sa2 can admit a pod with a template pod spec specified in my_resource.yaml
# Service Account specified in myresource.yaml file is ignored
oc adm policy scc-review -z sa1,sa2 -f my_resource.yaml
# Check whether service accounts system:serviceaccount:bob:default can admit a pod with a template pod spec specified in my_resource.yaml
oc adm policy scc-review -z system:serviceaccount:bob:default -f my_resource.yaml
# Check whether the service account specified in my_resource_with_sa.yaml can admit the pod
oc adm policy scc-review -f my_resource_with_sa.yaml
# Check whether the default service account can admit the pod; default is taken since no service account is defined in myresource_with_no_sa.yaml
oc adm policy scc-review -f myresource_with_no_sa.yaml
2.7.1.42. la politique d’OC adm scc-subject-review Copier lienLien copié sur presse-papiers!
Vérifiez si un utilisateur ou un compte de service peut créer un pod
Exemple d’utilisation
# Check whether user bob can create a pod specified in myresource.yaml
oc adm policy scc-subject-review -u bob -f myresource.yaml
# Check whether user bob who belongs to projectAdmin group can create a pod specified in myresource.yaml
oc adm policy scc-subject-review -u bob -g projectAdmin -f myresource.yaml
# Check whether a service account specified in the pod template spec in myresourcewithsa.yaml can create the pod
oc adm policy scc-subject-review -f myresourcewithsa.yaml
2.7.1.43. constructions OC adm prune Copier lienLien copié sur presse-papiers!
Enlever les anciennes constructions terminées et échouées
Exemple d’utilisation
# Dry run deleting older completed and failed builds and also including
# all builds whose associated build config no longer exists
oc adm prune builds --orphans
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune builds --orphans --confirm
2.7.1.44. déploiements OC adm prunes Copier lienLien copié sur presse-papiers!
Supprimer les anciennes configurations de déploiement terminées et échouées
Exemple d’utilisation
# Dry run deleting all but the last complete deployment for every deployment config
oc adm prune deployments --keep-complete=1
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune deployments --keep-complete=1 --confirm
2.7.1.45. groupes de prunes OC adm Copier lienLien copié sur presse-papiers!
Enlever les anciens groupes OpenShift faisant référence aux enregistrements manquants d’un fournisseur externe
Exemple d’utilisation
# Prune all orphaned groups
oc adm prune groups --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups except the ones from the denylist file
oc adm prune groups --blacklist=/path/to/denylist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in an allowlist file
oc adm prune groups --whitelist=/path/to/allowlist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
# Prune all orphaned groups from a list of specific groups specified in a list
oc adm prune groups groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
2.7.1.46. images de prunes OC adm Copier lienLien copié sur presse-papiers!
Enlever les images non référencées
Exemple d’utilisation
# See what the prune command would delete if only images and their referrers were more than an hour old
# and obsoleted by 3 newer revisions under the same tag were considered
oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m --confirm
# See what the prune command would delete if we are interested in removing images
# exceeding currently set limit ranges ('openshift.io/Image')
oc adm prune images --prune-over-size-limit
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune images --prune-over-size-limit --confirm
# Force the insecure HTTP protocol with the particular registry host name
oc adm prune images --registry-url=http://registry.example.org --confirm
# Force a secure connection with a custom certificate authority to the particular registry host name
oc adm prune images --registry-url=registry.example.org --certificate-authority=/path/to/custom/ca.crt --confirm
2.7.1.47. ajouter au panier OC adm prune rendermachineconfigs Copier lienLien copié sur presse-papiers!
Les pruneaux ont rendu MachineConfigs dans un cluster OpenShift
Exemple d’utilisation
# See what the prune command would delete if run with no options
oc adm prune renderedmachineconfigs
# To actually perform the prune operation, the confirm flag must be appended
oc adm prune renderedmachineconfigs --confirm
# See what the prune command would delete if run on the worker MachineConfigPool
oc adm prune renderedmachineconfigs --pool-name=worker
# Prunes 10 oldest rendered MachineConfigs in the cluster
oc adm prune renderedmachineconfigs --count=10 --confirm
# Prunes 10 oldest rendered MachineConfigs in the cluster for the worker MachineConfigPool
oc adm prune renderedmachineconfigs --count=10 --pool-name=worker --confirm
2.7.1.48. liste des configurations automatiques OC adm prune Copier lienLien copié sur presse-papiers!
Liste rendu MachineConfigs dans un cluster OpenShift
Exemple d’utilisation
# List all rendered MachineConfigs for the worker MachineConfigPool in the cluster
oc adm prune renderedmachineconfigs list --pool-name=worker
# List all rendered MachineConfigs in use by the cluster's MachineConfigPools
oc adm prune renderedmachineconfigs list --in-use
2.7.1.49. ajouter au panier OC adm reboot-machine-config-pool Copier lienLien copié sur presse-papiers!
Initier le redémarrage de la machineConfigPool spécifiée
Exemple d’utilisation
# Reboot all MachineConfigPools
oc adm reboot-machine-config-pool mcp/worker mcp/master
# Reboot all MachineConfigPools that inherit from worker. This include all custom MachineConfigPools and infra.
oc adm reboot-machine-config-pool mcp/worker
# Reboot masters
oc adm reboot-machine-config-pool mcp/master
2.7.1.50. extrait de libération d’OC adm Copier lienLien copié sur presse-papiers!
Extraire le contenu d’une charge utile de mise à jour sur le disque
Exemple d’utilisation
# Use git to check out the source code for the current cluster release to DIR
oc adm release extract --git=DIR
# Extract cloud credential requests for AWS
oc adm release extract --credentials-requests --cloud=aws
# Use git to check out the source code for the current cluster release to DIR from linux/s390x image
# Note: Wildcard filter is not supported; pass a single os/arch to extract
oc adm release extract --git=DIR quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
2.7.1.51. infos sur la libération d’OC adm Copier lienLien copié sur presse-papiers!
Afficher des informations sur une version
Exemple d’utilisation
# Show information about the cluster's current release
oc adm release info
# Show the source code that comprises a release
oc adm release info 4.11.2 --commit-urls
# Show the source code difference between two releases
oc adm release info 4.11.0 4.11.2 --commits
# Show where the images referenced by the release are located
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --pullspecs
# Show information about linux/s390x image
# Note: Wildcard filter is not supported; pass a single os/arch to extract
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
2.7.1.52. le miroir de libération d’OC adm Copier lienLien copié sur presse-papiers!
Afficher une version à un autre emplacement de registre d’images
Exemple d’utilisation
# Perform a dry run showing what would be mirrored, including the mirror objects
oc adm release mirror 4.11.0 --to myregistry.local/openshift/release \
--release-image-signature-to-dir /tmp/releases --dry-run
# Mirror a release into the current directory
oc adm release mirror 4.11.0 --to file://openshift/release \
--release-image-signature-to-dir /tmp/releases
# Mirror a release to another directory in the default location
oc adm release mirror 4.11.0 --to-dir /tmp/releases
# Upload a release from the current directory to another server
oc adm release mirror --from file://openshift/release --to myregistry.com/openshift/release \
--release-image-signature-to-dir /tmp/releases
# Mirror the 4.11.0 release to repository registry.example.com and apply signatures to connected cluster
oc adm release mirror --from=quay.io/openshift-release-dev/ocp-release:4.11.0-x86_64 \
--to=registry.example.com/your/repository --apply-release-image-signature
2.7.1.53. lancement d’OC adm Copier lienLien copié sur presse-papiers!
Créer une nouvelle version d’OpenShift
Exemple d’utilisation
# Create a release from the latest origin images and push to a DockerHub repository
oc adm release new --from-image-stream=4.11 -n origin --to-image docker.io/mycompany/myrepo:latest
# Create a new release with updated metadata from a previous release
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11 --name 4.11.1 \
--previous 4.11.0 --metadata ... --to-image docker.io/mycompany/myrepo:latest
# Create a new release and override a single image
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11 \
cli=docker.io/mycompany/cli:latest --to-image docker.io/mycompany/myrepo:latest
# Run a verification pass to ensure the release can be reproduced
oc adm release new --from-release registry.ci.openshift.org/origin/release:v4.11
2.7.1.54. ajouter au panier OC adm redémarrer-kubelet Copier lienLien copié sur presse-papiers!
Kubelet redémarrer sur les nœuds spécifiés
Exemple d’utilisation
# Restart all the nodes, 10% at a time
oc adm restart-kubelet nodes --all --directive=RemoveKubeletKubeconfig
# Restart all the nodes, 20 nodes at a time
oc adm restart-kubelet nodes --all --parallelism=20 --directive=RemoveKubeletKubeconfig
# Restart all the nodes, 15% at a time
oc adm restart-kubelet nodes --all --parallelism=15% --directive=RemoveKubeletKubeconfig
# Restart all the masters at the same time
oc adm restart-kubelet nodes -l node-role.kubernetes.io/master --parallelism=100% --directive=RemoveKubeletKubeconfig
2.7.1.55. ajouter au panier OC adm taint Copier lienLien copié sur presse-papiers!
Actualisez les taches sur un ou plusieurs nœuds
Exemple d’utilisation
# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'
# If a taint with that key and effect already exists, its value is replaced as specified
oc adm taint nodes foo dedicated=special-user:NoSchedule
# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists
oc adm taint nodes foo dedicated:NoSchedule-
# Remove from node 'foo' all the taints with key 'dedicated'
oc adm taint nodes foo dedicated-
# Add a taint with key 'dedicated' on nodes having label myLabel=X
oc adm taint node -l myLabel=X dedicated=foo:PreferNoSchedule
# Add to node 'foo' a taint with key 'bar' and no value
oc adm taint nodes foo bar:NoSchedule
2.7.1.56. images haut OC adm Copier lienLien copié sur presse-papiers!
Afficher les statistiques d’utilisation des images
Exemple d’utilisation
# Show usage statistics for images
oc adm top images
2.7.1.57. flux d’images haut OC adm Copier lienLien copié sur presse-papiers!
Afficher les statistiques d’utilisation pour les flux d’images
Exemple d’utilisation
# Show usage statistics for image streams
oc adm top imagestreams
2.7.1.58. nœud supérieur OC adm Copier lienLien copié sur presse-papiers!
Afficher la ressource (CPU/mémoire) utilisation des nœuds
Exemple d’utilisation
# Show metrics for all nodes
oc adm top node
# Show metrics for a given node
oc adm top node NODE_NAME
2.7.1.59. ajouter au panier OC adm top pod Copier lienLien copié sur presse-papiers!
Afficher la ressource (CPU/mémoire) utilisation des pods
Exemple d’utilisation
# Show metrics for all pods in the default namespace
oc adm top pod
# Show metrics for all pods in the given namespace
oc adm top pod --namespace=NAMESPACE
# Show metrics for a given pod and its containers
oc adm top pod POD_NAME --containers
# Show metrics for the pods defined by label name=myLabel
oc adm top pod -l name=myLabel
2.7.1.60. ajouter au panier OC adm uncordon Copier lienLien copié sur presse-papiers!
Nœud de marque comme calendrier
Exemple d’utilisation
# Mark node "foo" as schedulable
oc adm uncordon foo
2.7.1.61. amélioration d’OC adm Copier lienLien copié sur presse-papiers!
Améliorez un cluster ou ajustez le canal de mise à niveau
Exemple d’utilisation
# View the update status and available cluster updates
oc adm upgrade
# Update to the latest version
oc adm upgrade --to-latest=true
2.7.1.62. adm d’OC check-image-signature Copier lienLien copié sur presse-papiers!
Vérifier l’identité de l’image contenue dans la signature de l’image
Exemple d’utilisation
# Verify the image signature and identity using the local GPG keychain
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1
# Verify the image signature and identity using the local GPG keychain and save the status
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1 --save
# Verify the image signature and identity via exposed registry route
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 \
--expected-identity=registry.local:5000/foo/bar:v1 \
--registry-url=docker-registry.foo.com
# Remove all signature verifications from the image
oc adm verify-image-signature sha256:c841e9b64e4579bd56c794bdd7c36e1c257110fd2404bebbb8b613e4935228c4 --remove-all
2.7.1.63. adm OC wait-for-node-reboot Copier lienLien copié sur presse-papiers!
Attendez que les nœuds redémarrent après avoir exécuté oc adm reboot-machine-config-pool
Exemple d’utilisation
# Wait for all nodes to complete a requested reboot from 'oc adm reboot-machine-config-pool mcp/worker mcp/master'
oc adm wait-for-node-reboot nodes --all
# Wait for masters to complete a requested reboot from 'oc adm reboot-machine-config-pool mcp/master'
oc adm wait-for-node-reboot nodes -l node-role.kubernetes.io/master
# Wait for masters to complete a specific reboot
oc adm wait-for-node-reboot nodes -l node-role.kubernetes.io/master --reboot-number=4
2.7.1.64. ajouter au panier OC adm wait-for-stable-cluster Copier lienLien copié sur presse-papiers!
Attendez que les opérateurs de plate-forme deviennent stables
Exemple d’utilisation
# Wait for all cluster operators to become stable
oc adm wait-for-stable-cluster
# Consider operators to be stable if they report as such for 5 minutes straight
oc adm wait-for-stable-cluster --minimum-stable-period 5m