Step-by-Step Guide to Setup OpenShift on Your Local Machine
Rohaan Joshi
PMP Certified Senior DevOps Engineer | AWS DevOps Professional | Kubernetes | AWS | 2x Azure | OpenShift | PCI Compliance | API Security | Ansible | Terraform | Docker | GitHub | GitLab | Splunk | Python | MLOps
Setting up OpenShift on your local machine is crucial for efficient application development and testing. Follow these steps to install and configure OpenShift locally for seamless deployment and testing.
What is OpenShift?
OpenShift is a containerization platform developed by Red Hat that allows developers to build, deploy, and manage applications in containerized environments. It is built around Kubernetes, an open-source container orchestration system, and adds additional features to simplify application lifecycle management.
Key features of OpenShift include:
1. Container Orchestration: OpenShift uses Kubernetes to automate the deployment, scaling, and management of containerized applications.
2. Developer Tools: It provides a rich set of developer tools and workflows, including integrated development environments (IDEs), continuous integration and continuous deployment (CI/CD) pipelines, and Git integration.
3. Multi-Tenancy: OpenShift supports multi-tenancy, allowing multiple teams or applications to run securely and independently on the same cluster.
4. Security: It includes built-in security features such as role-based access control (RBAC), network policies, and image scanning to ensure secure application deployment.
5. Application Lifecycle Management: OpenShift simplifies the management of application lifecycles with features like automated rollouts and rollbacks, monitoring, logging, and metrics.
6. Hybrid Cloud Deployment: It supports deployment across hybrid and multi-cloud environments, providing consistency and flexibility in application deployment.
OpenShift is designed to streamline the process of containerized application development and deployment, making it easier for teams to build and manage modern cloud-native applications. Today we are seeing how to install it on your local system.
Key Differences Between OpenShift and Kubernetes
OpenShift and Kubernetes (often abbreviated as K8s) are related but serve different purposes in the realm of container orchestration and management.
1. Vendor and Support:
- Kubernetes: Kubernetes is an open-source container orchestration platform initially developed by Google. It is maintained by the Cloud Native Computing Foundation (CNCF) and has a large community of contributors and users.
- OpenShift: OpenShift is a Kubernetes-based container platform developed by Red Hat. It includes Kubernetes at its core but adds additional features, tools, and services to enhance usability, security, and manageability.
2. Additional Features:
- Kubernetes: Provides core orchestration capabilities such as pod management, scheduling, service discovery, and load balancing.
- OpenShift: Builds on Kubernetes by adding additional features such as integrated developer tools (like source-to-image builds), automated scaling, monitoring, logging, security features (like role-based access control and image scanning), and developer workflows. OpenShift also includes a web console for easier management and administration.
3. Ecosystem and Integration:
- Kubernetes: Has a vast ecosystem of third-party tools, plugins, and integrations due to its open-source nature and widespread adoption.
- OpenShift: Integrates with Red Hat's ecosystem of products and services, including Red Hat Enterprise Linux (RHEL), JBoss middleware, and Ansible for automation. It also supports integration with various CI/CD tools and developer environments.
4. Ease of Use and Management:
- Kubernetes: Provides flexibility and customization but requires more manual configuration and management compared to higher-level platforms.
- OpenShift: Offers a more streamlined and opinionated approach, focusing on ease of use, automation, and built-in tools to simplify application development, deployment, and management. This can make it more accessible to developers and teams looking for an integrated solution.
5. Deployment Models:
- Kubernetes: Can be deployed on any infrastructure, including public cloud providers (like AWS, Azure, and Google Cloud), on-premises data centers, and hybrid cloud environments.
- OpenShift: Supports similar deployment models but is often associated with Red Hat's OpenShift Container Platform, which can include enterprise support and services tailored for specific environments.
Kubernetes provides core container orchestration capabilities, OpenShift extends Kubernetes with additional tools, services, and integration to support enterprise-grade containerized applications with enhanced security, management, and developer experience.
Prerequisites:
OpenShift Micro Edition, known as CodeReady Containers, offers a lightweight solution to deploy an OpenShift cluster locally on your machine, akin to Minikube for Kubernetes. This platform is specifically tailored for development and educational purposes, providing a streamlined environment for testing and learning.
领英推荐
Installation Steps for OpenShift:
Step 1: Download and Install CodeReady Containers:
Step 2: Open Terminal:
Execute the following commands sequentially:
$ crc setup
In this stage it download all the dependancies from Redhat
$ crc start
This stage it configure the Signle Node cluster and stepping the VM
Congratulations! You have successfully installed OpenShift Micro Edition on your local machine.
Note:
To get these default credentials again
$ crc console --credentials
Username: kubeadmin
Password: assdfdfwrrgtgyujiixdcgthyh
Log in as user:
Username: developer
Password: developer
Use the 'oc' command line interface:
$ eval $(crc oc-env)
$ oc login -u developer https://api.crc.testing:6443
https://console-openshift-console.apps-crc.testing
To stop the cluster
$ crc stop
To delete the cluster and reclaim resources
$ crc delete
Pro's:
Cron's:
Summary
The step-by-step guide to setting up OpenShift on your local machine provides a comprehensive approach to installing and configuring OpenShift locally. It covers essential prerequisites such as what is OpenShift, how it different from Kubernetes, requirements and necessary software dependencies like Docker and the OpenShift CLI (oc). The guide then walks through installation using CodeReady Containers for OpenShift 4.x. Each method includes downloading the appropriate software, installing it based on the operating system, and initializing a local OpenShift cluster. This setup enables developers to efficiently develop, test, and learn about OpenShift without needing access to a dedicated server or cloud environment.