Kubectl and OpenShift: Working Together for Kubernetes Success

Kubectl and OpenShift are the two tools at the center of modern Kubernetes operations. Kubectl is the CLI for Kubernetes. OpenShift is Red Hat’s Kubernetes distribution with built-in security, multi-tenancy, and developer tooling. Knowing how they work together means faster deployments, cleaner workflows, and fewer production surprises.

Kubectl connects directly to the Kubernetes API. It lets you create, update, inspect, and delete resources in a cluster. Pods, deployments, services—all managed in seconds. OpenShift enhances this with its own CLI, oc, which builds on kubectl commands and adds OpenShift-specific features. You can run most kubectl commands in OpenShift because oc supports the same syntax, but it also handles OpenShift objects like Routes, Projects, and BuildConfigs.

Basic kubectl commands for OpenShift:

  • kubectl get pods checks running workloads.
  • kubectl apply -f resource.yaml applies changes from a manifest.
  • kubectl logs pod-name streams container logs.

In OpenShift, these work with the same underlying Kubernetes API. But you’ll often use oc to manage OpenShift’s custom resources or to log into the cluster using OAuth. You can switch between kubectl and oc without losing context, as both respect the kubeconfig file and current namespace.

Key differences to remember:

  • OpenShift defaults to stricter security, meaning some kubectl commands may require additional permissions.
  • OpenShift’s build and deployment processes can bypass manual kubectl workflows if you use its pipelines.
  • Route objects in OpenShift replace traditional Kubernetes Ingress, so direct kubectl ingress commands may not apply.

Best practices when using kubectl with OpenShift:

  1. Authenticate with oc login first.
  2. Keep manifests portable between vanilla Kubernetes and OpenShift—avoid hardcoding OpenShift-only resources unless necessary.
  3. Use kubectl for quick inspection and generic Kubernetes tasks; use oc for everything that’s OpenShift-specific.

If you understand kubectl in pure Kubernetes, you can work in OpenShift without friction. The skill transfers almost one-to-one. The main shift is knowing when OpenShift extends or replaces Kubernetes defaults.

Run a command. Watch the change spread across the cluster. That’s the power of kubectl and OpenShift in sync.

See it live in minutes at hoop.dev and take command of your cluster without waiting.