OpenShift CLI: "oc" and "kubectl" have different behaviours
Environment
- Openshift Container Platform 3.11.
Issue
- The command "kubectl" is a symbolic link to /usr/bin/oc, the binary file where the command "oc" is implemented. However, "oc" and "kubectl" have different behaviours when they are executed.
# which oc
/usr/bin/oc
# which kubectl
/usr/bin/kubectl
# readlink -e /usr/bin/kubectl
/usr/bin/oc
# oc version
oc v3.11.59
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://master1.local:8443
openshift v3.11.59
kubernetes v1.11.0+d4cacc0
# kubectl version
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-12-18T16:26:37Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-12-18T16:26:37Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Root Cause
-
As mentioned on the product documentation, oc is built on top of kubectl.
-
OpenShift CLI is distributed as a single binary that can act as a different tool depending on its name and/or symlinks. So if named as (or have a symlink created with the name) "oc", it will provide higher-level commands generally targeted for end-users. If renamed to "kubectl", it will provide only the functionality of a kubectl binary.
-
"oc" provides more functionalities than "kubectl" on OpenShift and it is the recommended command.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments