The OpenShift client

The OpenShift client helps manage the platform from an operational point of view. You can deploy new applications, scale existing ones, to any Kubernetes or OpenShift cluster.

The client tool also includes a special sub-command, adm, to do administrative tasks.

Here is how it's used:

oc [flags]

The basic commands are as follows:

  • types: An introduction to concepts and types
  • login: Log in to a server
  • new-project: Request a new project
  • new-app: Create a new application
  • status: Show an overview of the current project
  • project: Switch to another project
  • projects: Display existing projects
  • explain: Documentation of resources
  • cluster: Start and stop OpenShift cluster

The build and deploy commands are as follows:

  • rollout: Manage a Kubernetes deployment or OpenShift deployment config
  • rollback: Revert part of an application back to a previous deployment
  • new-build: Create a new build configuration
  • start-build: Start a new build
  • cancel-build: Cancel running, pending, or new builds
  • import-image: Import images from a Docker registry
  • tag: Tag existing images into image streams

The application management commands are as follows:

  • get: Display one or many resources
  • describe: Show details of a specific resource or group of resources
  • edit: Edit a resource on the server
  • set: Commands that help set specific features on objects
  • label: Update the labels on a resource
  • annotate: Update the annotations on a resource
  • expose: Expose a replicated application as a service or route
  • delete: Delete one or more resources
  • scale: Change the number of pods in a deployment
  • autoscale: Auto scale a deployment config, deployment, replication controller, or replica set
  • secrets: Manage secrets
  • serviceaccounts: Manage service accounts in your project

The troubleshooting and debugging commands are as follows:

  • logs: Print the logs for a resource
  • rsh: Start a shell session in a pod
  • rsync: Copy files between local filesystem and a pod
  • port-forward: Forward one or more local ports to a pod
  • debug: Launch a new instance of a pod for debugging
  • exec: Execute a command in a container
  • proxy:  Run a proxy to the Kubernetes API server
  • attach: Attach to a running container
  • run: Run a particular image on the cluster
  • cp: Copy files and directories to and from containers.
  • wait: Wait for one condition on one or many resources (this is still experimental)

The advanced commands are as follows:

  • adm: Tools for managing a cluster
  • create: Create a resource from a file or from standard input
  • replace: Replace a resource by filename or standard input
  • apply: Apply a config to a resource by filename or standard input
  • patch: Update field(s) of a resource using strategic merge patch
  • process: Process a template into list of resources
  • export: Export resources so they can be used elsewhere
  • extract: Extract secrets or config maps to disk
  • idle: Idle scalable resources
  • observe: Observe changes to resources and react to them (this is still experimental)
  • policy: Manage authorization policy
  • auth: Inspect authorization
  • convert: Convert config files between different API versions
  • import: Commands that import applications
  • image: Useful commands for managing images
  • registry: Commands for working with the registry
  • api-versions: Print the supported API versions on the server, in the form of group/version
  • api-resources: Print the supported API resources on the server

The settings commands are as follows:

  • logout: End the current server session
  • config: Change configuration files for the client
  • whoami: Return information about the current session
  • completion: Output shell completion code for the specified shell (bash or zsh)

Some other commands are as follows:

  • ex: Experimental commands under active development
  • help: Get help with any command
  • plugin: Run a command-line plugin
  • version: Display client and server versions

Use oc <command> --help for more information about a given command.

In our case, we run the command oc cluster with the flag up. To check any composite commands such as oc cluster, use the --help directive, as follows:

# ./oc cluster --help

You can refer to the following link for more information: https://rasor.github.io/developing-with-openshift.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset