To understand OpenShift Fundamentals, lets start with first Couple of Analogies and then we will go in bit detail.
Analogy 1:
- OpenShift is like a shipping port for containerized applications. It provides a platform for developers to build, deploy, and manage their applications, and it takes care of all the underlying infrastructure, such as the Kubernetes orchestration platform and the operating system.
- Just like a shipping port, OpenShift provides a number of services that make it easier to manage containerized applications, such as:
- Automated provisioning and deployment: OpenShift can automatically provision and deploy containerized applications, making it easy for developers to get their applications up and running quickly.
Load balancing and scaling: OpenShift can automatically load balance and scale containerized applications, ensuring that they are always available and responsive to user traffic.
Security and compliance: OpenShift provides a number of security and compliance features, such as role-based access control and auditing, to help protect containerized applications and their data.
Analogy 2:
OpenShift is like a factory assembly line for containerized applications. It provides a set of tools and services that help developers build, test, and deploy their applications in a consistent and efficient way.
Just like a factory assembly line, OpenShift can help developers to:
- Automate the development and deployment process: OpenShift can automate many of the tasks involved in developing and deploying containerized applications, such as building images, running tests, and pushing images to a registry.
- Collaborate and share code: OpenShift makes it easy for developers to collaborate on projects and share code with each other.
- Monitor and troubleshoot applications: OpenShift provides a number of tools for monitoring and troubleshooting containerized applications, making it easy to identify and fix problems quickly.
Now lets go through Some Explaination.
OpenShift is a container platform that helps developers build, deploy, and manage containerized applications. It is built on top of Kubernetes, a container orchestration platform that automates many of the tasks involved in managing containerized applications.
OpenShift provides a number of features that make it easier to develop and deploy containerized applications, such as:
- A web-based console: OpenShift provides a web-based console that makes it easy to manage containerized applications without having to use the command line.
- A built-in registry: OpenShift includes a built-in registry for storing container images. This makes it easy to share container images with other developers and to deploy containerized applications to different environments.
- A variety of tools and services: OpenShift provides a variety of tools and services that can be used to develop, deploy, and manage containerized applications. This includes tools for building container images, running tests, monitoring applications, and managing security.
OpenShift can be deployed on a variety of infrastructure platforms, including bare metal, virtual machines, and cloud platforms. This makes it a flexible and versatile container platform that can be used to meet the needs of a wide range of organizations.
OpenShift is Red Hat's cloud development Platform as a Service (PaaS). It's a platform that allows developers to build, deploy, and scale applications in a cloud environment. OpenShift takes care of all the infrastructure management and allows developers to focus purely on code.
Key Features and Components:
- Kubernetes at its Core: OpenShift is essentially a distribution of Kubernetes, which means it leverages Kubernetes' container orchestration capabilities but with added developer and operational tools.
- Source-to-Image (S2I): One of OpenShift's unique features. It allows developers to automatically build a Docker-formatted container image from application source code without writing a Dockerfile.
- Integrated Developer Tools: OpenShift comes with a built-in CI/CD, logging, and monitoring tools. It integrates seamlessly with popular tools like Jenkins.
- Routing Layer: OpenShift has a built-in routing layer that automatically exposes your services to the outside world.
- Self-Service & On-Demand Provisioning: Developers can instantaneously provision a fully functional development environment without waiting for infrastructure provisioning.
- Security: OpenShift offers multi-tenancy and robust security features. For example, each application runs in its own isolated container, and SELinux is employed to ensure isolation between containers.
Conceptual Components:
- Projects: A project is essentially a Kubernetes namespace with additional annotations. It's a way to divide cluster resources between multiple users.
- Pods: Like Kubernetes, the smallest deployable unit in OpenShift is a pod. A pod can host multiple containers that form a single unit of deployment.
- Services: Services define a set of pods and a means to access them, either internally or externally.
- Routes: A route is an external URL that maps to a service, making it accessible outside the cluster.
- BuildConfig: This defines the build process for applications, including the source location, strategy, and output.
- DeploymentConfig: Defines the deployment process for applications, ensuring the right number of pods are maintained.
Benefits of OpenShift:
- Streamlined Development: With built-in tools and automation, developers can focus on writing code.
- Hybrid & Multi-Cloud: OpenShift can be run on-premise or on almost any cloud provider, giving businesses flexibility.
- Scalability: Being based on Kubernetes, OpenShift offers the same high-level scalability, enabling applications to handle increased loads.
- Enterprise Support: OpenShift, being a product of Red Hat, offers enterprise-level support, ensuring businesses can get help when needed.
Starting with OpenShift:
- OpenShift Online: A managed service offered by Red Hat. It's a good way to start if you want to try OpenShift without setting up any infrastructure.
- OpenShift Container Platform (OCP): This is the enterprise version you can install on your own infrastructure or any cloud provider.
- OpenShift Origin (OKD): The open-source version of OpenShift. It's free and is a good way to get started if you're comfortable setting up things yourself.
- Learning: There's a rich set of documentation available, and Red Hat offers courses for OpenShift as well.
In summary, OpenShift is a powerful platform that combines Kubernetes' orchestration power with tools beneficial for developers and operations. It abstracts much of the complexities of managing and scaling applications, enabling faster innovation and deployment. What Is the Difference Between IaaS, PaaS, and SaaS? Let’s start by clearing up some "cloud computing" acronyms that people like to throw around.
Infrastructure as a Service (IaaS):
Imagine you want a computer, but instead of buying one, you can rent it from a company online. This company, like Amazon or Google, will let you choose how strong or fast you want that computer to be. Once you've made your choice, they'll give you access to that computer in just a few minutes. The catch? Even though you're renting it, you'll need to set up everything on it yourself, like when you first buy a new computer. It's like renting a house and bringing in all your furniture.
- It's like renting a computer online.
- You choose the computer's power and storage.
- Amazon EC2, Microsoft Azure, and Google Compute Engine are popular providers.
- Once you get the computer, you need to set it up (like installing Windows or Mac on a new PC).
- It's good because you get a computer quickly without buying one.
- But, you still need to manage and take care of that computer.
Software as a Service (SaaS):
Now, think of online services you use daily, like Gmail. You didn't create Gmail, but you use it freely. In this case, the company handles everything for you. You just sign up and use it, but you can't change how Gmail looks or functions significantly. It's like going to a hotel; everything is provided for you, but you can't change the room layout.
- It's like signing up for an online service, like Gmail or Facebook.
- You just use it; you don't manage or set up anything.
- But, you can't change much about how the service looks or works.
- It's like a toy: you can play with it, but you can't modify it much.
Platform as a Service (PaaS):
Finally, imagine you're someone who likes building things, like apps or websites. You need tools and a space to work. Instead of creating a workspace from scratch, a company provides you with a ready-to-use workshop. They handle all the background work, like setting up the workbench or ensuring the tools work. You just enter and start building. It's a balance between the first two: you have more control than just using something like Gmail, but you don't have to worry about all the setup like with the rented computer. It's like renting a workshop that's ready for you to start your project.
- It's a mix of renting a computer and using a service.
- It's for people who make apps or websites.
- You get tools to build your app without worrying about the technical stuff.
- For instance, with OpenShift, you type a command, and it sets up everything for you.
- It lets you focus on creating, while someone else handles the tech maintenance.
Three Version of OpenShift.
OpenShift: Think of OpenShift as a toolbox made by a company called Red Hat. This toolbox lets you easily build and run apps without worrying about the complicated stuff behind the scenes. There are three types of this toolbox:
1. OpenShift Origin: This is the free, basic version of OpenShift. It's like a do-it-yourself kit. If you choose this, you'll have to set it up on your computer or network. Everyone can see how it's made because it's on a site called GitHub.
2. OpenShift Online: This is like a 'ready-to-use' version. Red Hat manages everything for you, and it runs on a platform called Amazon Web Services. It's updated regularly (every three weeks). In simple terms, you sign up, and you can start building your apps without worrying about the technical bits. This is the version we'll talk about in the book.
3. OpenShift Enterprise: This is the premium, fully-loaded toolbox. You can use it wherever you like, whether on your personal computer or on big servers. It comes with special features and top-tier support from Red Hat. It's made for companies that want something stable and ready for serious work. This version might not have all the latest features immediately because stability is more important. A cool thing? This version makes both the tech experts and app creators in a company happy because it's fast and flexible.
Lastly, the good news is that you can switch between these versions if needed. For instance, a team might start building an app on the Online version but later decide to use the Enterprise one for extra security or features. It offers flexibility, which is great for trying new things or moving projects around as needed. Choosing the Right Tool for Your Work: Think of OpenShift as a toolbox with different versions, and you're trying to pick the best one for your job. 1. Already Decided: If you're in a company that's already picked a version like OpenShift Enterprise, then that's the one you'll use. 2. Want Everything Handled for You?: Choose OpenShift Online. It's like renting a fully-furnished apartment. You don't have to worry about furniture or utilities; just move in and live. The only thing is, you can't change the furniture or paint the walls as you wish. 3. DIY Lover?: If you love setting up things from scratch and want the latest features, OpenShift Origin might be your choice. Think of it as building your own house, picking everything from bricks to paint. But remember, you'll be the one fixing any leaks! 4. Need Stability & Support?: Go for OpenShift Enterprise. It's like a well-built house with a team ready to help if anything goes wrong.
Who might use which version?: OpenShift Online: Perfect for quick projects, startups, students, or small teams in big companies. OpenShift Origin: Great for companies testing the idea of having their own toolbox or schools that want students to experiment and learn. Remember, the world of tech is moving fast. In no time, even big companies might be using these online toolboxes for important projects. One of the authors even jokes he'd bet a drink that this will happen soon! Now, with this overview, we'll dive deeper into how OpenShift works and how you can start using it. Before You Dive In: Even if you're excited to get started, we first need to be on the same page about certain terms and tools. If you're already a tech guru, you might find the next section familiar. If so, you can skip it. If not, let's get these definitions down.
Key Terms in OpenShift:
Application:
- Think of this as your regular online website or web app.
- Currently, OpenShift is best for these kinds of apps.
- Only specific paths (called "ports") like the regular web, secure web, and a technical path called SSH are open to users. There's also a test version for "WebSockets."
Gear:
- Imagine a box in the cloud that has resources to run your app. That's a gear.
- There are different sizes of these boxes: small, medium, and large. They vary mainly in memory and storage space.
Cartridge:
- Cartridges make gears functional. They're like apps for your smartphone.
- There are two main types:
- Standalone: These are the main systems that show your web content. Examples include things like Python or Node.js.
- Embedded: These add extra functions to your app, like a timer or database, but can't run an app by themselves.
Scalable application: This is a smart app. If more people visit your web app, it can automatically get more resources to handle the load. If the visitors decrease, it scales down. It's like a shop hiring more staff during a sale.
Tools to Control OpenShift:
- Client tools: These are commands you can run from your computer to control OpenShift.
- Web Console: A web interface to manage OpenShift.
- Eclipse plug-ins: If you use the Eclipse software, you can add a special tool to interact with OpenShift.
Tech Basics You Should Know:
To smoothly work with OpenShift, you'll also need to understand some essential tech tools and concepts, which the book will explore in detail. Think of these as foundational skills to get the most out of OpenShift.
Here's a summary of the technology you need to understand to effectively work with OpenShift:
1. SSH (Secure Shell): A secure method to log into remote machines and execute commands.
- Ensures encrypted interactions.
- Utilizes keys for authentication, eliminating the need for passwords.
- Provides application developers ample access to perform tasks like viewing logs and modifying configurations, but not full admin rights.
- Can "trick" your local machine into thinking that the resources on the remote server are locally accessible (called port forwarding).
2. Git (Distributed Version Control System):
- Unlike centralized systems like Subversion, in Git, every copy of the codebase is a full version control repository.
- This means that each repository can operate independently and changes are shared between repositories as patches.
- Key Points about Git with OpenShift:
- Initially, a Git repository is set up on the primary application gear.
- You'll clone this repository to your local machine.
- Secure interactions with the repository use SSH.
- Basic commands include:
- git add: Add files to the repository.
- git commit: Save changes to the repository.
- git push: Push changes to the remote repository.
Difference between Git and GitHub:
- Git is the tool or system.
- GitHub is a platform that hosts Git repositories and adds a social layer for collaboration.
- While OpenShift utilizes Git, it doesn't require the use of GitHub. Your application's repositories are private.
With the foundational understanding of these technologies, you're better equipped to begin creating applications on OpenShift. The chapter aims to equip readers with the essential knowledge needed to get started without delving deep into OpenShift's architecture or additional tools. With these preliminaries covered, it's time to dive into creating a web application on OpenShift.