Red Hat OpenShift // TLDR

Basic Commands

  • Login:
    Bash
    oc login https://<master-server>:8443 -u <username> -p <password>
    
  • Get Current User:
    Bash
    oc whoami
    
  • Get Cluster Status:
    Bash
    oc status
    
  • Get All Projects:
    Bash
    oc get projects
    
  • Switch Projects:
    Bash
    oc project <project-name>
    

Creating and Managing Resources

  • Create a New Application:
    Bash
    oc new-app <image-stream-tag>:<tag>
    
  • Create a Build Configuration:
    Bash
    oc new-build --binary <path-to-binary>
    
  • Get Pods:
    Bash
    oc get pods
    
  • Describe a Pod:
    Bash
    oc describe pod <pod-name>
    
  • Execute a Command in a Pod:
    Bash
    oc exec -it <pod-name> -- <command>
    
  • Expose a Service:
    Bash
    oc expose service <service-name>
    
  • Get Routes:
    Bash
    oc get routes
    

Troubleshooting

  • Get Logs:
    Bash
    oc logs <pod-name>
    
  • Get Events:
    Bash
    oc get events
    
  • Describe a Resource:
    Bash
    oc describe <resource-name>
    

Additional Tips

Core Concepts

  • Container: A standardized unit of software that packages code and all its dependencies, ensuring consistent execution across different environments.
  • Image: A read-only template with software, libraries, tools, configuration files, and other dependencies needed to run an application.
  • Pod: The smallest deployable unit in Kubernetes and OpenShift, consisting of one or more containers that share storage and network resources.
  • Deployment: A Kubernetes resource that manages the replication of Pods.
  • Service: A Kubernetes resource that defines a logical set of Pods and a policy to access them.
  • Route: A Kubernetes resource that maps a URL to a service.
  • Build Configuration: Defines how to build a container image from source code.
  • Image Stream: Stores container images and their metadata.

OpenShift-Specific Concepts

  • Project: A logical grouping of resources in OpenShift.
  • Template: A reusable configuration for creating new applications.
  • Operator: A software extension that manages the lifecycle of complex applications.
  • Source-to-Image (S2I): A build strategy that automates the process of building container images from source code.
  • OpenShift Container Platform (OCP): The overall platform, encompassing Kubernetes, container registry, and other components.

Additional Terms

  • Kubernetes: An open-source platform for automating deployment, scaling, and management of containerized applications.
  • Docker: A platform for developing, shipping, and running applications in containers.
  • Red Hat: The company behind OpenShift.

Would you like to explore any of these terms in more detail? Or perhaps you have a specific question about OpenShift?

Helpful Resources

Remember to adapt this cheat sheet to your specific use cases and consult the official documentation for more in-depth information.