OpenShift oc is not recognized as command

Objective of this article to make you understand how to solve the problem of OpenShift oc command is not recognized as an internal or external command in CLI.

oc is not recognized as command

To overcome this problem we have to setup the path of the OpenShift CLI which we can get is by executing the below command.

minishift oc-env

oc environment details

Copy the full line of set path and execute the same. SET PATH=C:\Users\subbaiah.nallamachu.minishift\cache\oc\v3.11.0\windows;%PATH%

openshift path setup

Now the system will not throw the problem of not recognized as a command.

How to list all OpenShift supported commands?

This is very simple task to identify the list of OpenShift supported commands. Issue the oc –help to get list of commands.

C:\minishift-1.34.2-windows-amd64>oc –help
OpenShift Client
This client helps you develop, build, deploy, and run your applications on any OpenShift or Kubernetes compatible
platform. It also includes the administrative commands for managing a cluster under the ‘adm’ subcommand.
  oc [flags]
Basic Commands:
  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
Build and Deploy Commands:
  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    Imports images from a Docker registry
  tag             Tag existing images into image streams
Application Management Commands:
  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       Autoscale a deployment config, deployment, replication controller, or replica set
  secrets         Manage secrets
  serviceaccounts Manage service accounts in your project
Troubleshooting and Debugging Commands:
  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            Experimental: Wait for one condition on one or many resources
Advanced Commands:
  adm             Tools for managing a cluster
  create          Create a resource from a file or from stdin.
  replace         Replace a resource by filename or stdin
  apply           Apply a configuration to a resource by filename or stdin
  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 (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
Settings Commands:
  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)
Other Commands:
  ex              Experimental commands under active development
  help            Help about any command
  plugin          Runs a command-line plugin
  version         Display client and server versions
Use “oc <command> –help” for more information about a given command.
Use “oc options” for a list of global command-line options (applies to all commands).
Commands supported in OpenShift

OpenShift Setup Options

Objective of this article is to make you understand what are different ways there to setup OpenShift. Prior to that we need to understand what different options are available to configure OpenShift. In the current article explained about All in One setup and other are not explaining because of no environment support.

  1. All in one is a kind of development environment setup where we can install Master and child nodes in a single machine. This is not supported or suggested for Production environment.
  2. Single Master & multiple Nodes: There is only one Master setup which needs to serve multiple child nodes across different clusters. Suggested to use higher to develop and below production environment.
  3. Multiple Master & multiple Nodes: There are multiple nodes configured to serve multiple child nodes across different clusters. This is highly recommended to use in Production environment.
Types of OpenShift Setups

OpenShift can be installed on Premises or hosted on Public / Private cloud. There are 2 different ways exists to setup OpenShift.

  1. Package Manager (RPM)
  2. Containerized (Docker)

Note: Containerized tools are recommended to use than RPM because RPM is traditional way of setting up OpenShift.

All – in – One:

As explained in OpenShift architecture, OpenShift uses Kubernetes as underlying environment and etcd is the heart of the OpenShift and OpenShift components all together are packed into single image name called MiniShift. MiniShift provides the single node open cluster so setup & getting started with OpenShift is easy. MiniShift complete bundle packaged into ISO image and is available to download from online through MiniShift CLI command.

Minishift all in one

Once the MiniShift command issued, it will download OpenShift the image of openshift/origin from Docker Hub to deploy the Core components. This image will download further required images from docker hub such as Docker Registry, Router, Web Console.

Note: As of now I don’t have the supported environment to practice about other two types like Single master with multiple child nodes and Multiple masters and multi child node configuration.

Kindly go through the below link and setup the oracle virtual box prior to proceeding further articles.

Note: Just setup the virtual box and make it up and running, no need to download any images and run them. Minishift will automatically pulls the image and start while we issue start command. For further understanding of minishift setup with virtual box, use below link.