Kubernetes is crazy complex and powerful. With multiple features and configuration options, it can be overwhelming to get started. In our last webinar Raziel Tabib (Codefresh Co-Founder & CEO) gave a quick intro with only the information you need to know to get our first app up and running in 10 minutes.
View the webinar on-demand to learn:
• What Kubernetes is – Intro into the fundamental concepts of and main entities of Kubernetes, the open-source container management system
• How to use it – Live demo of how to run a simple microservices app on Kubernetes
Highlights of Raziel’s Talk
What is Kubernetes?
- Kubernetes is one of the most popular tools for orchestrating and managing containers in production
- Key strengths – easy to deploy changes on the fly
- Kubernetes is an open-source project designed by Google
Entities We Need to Know to Get Started
Pods
- A Pod is the smallest deployable unit in Kubernetes
- Whenever you deploy a container it runs within a Pod
- You usually only run a single container inside a Pod. You can run more than one container inside a Pod if you want the containers to share volumes or run on same physical machine
Deployment
It’s possible to manually manage Pods (create, monitor, stop, etc.) but we don’t want to do that. Deployment is a super powerful entity within Kubernetes that simplifies the management of Pods. The most efficient way to benefit from Kubernetes is to use Deployment to create Pods, scale them, etc. Deployments even monitor the health of your Pods so if one fails, it will automatically create a new pod to take its place. You can easily rollout/ rollback changes to the pods, for example, if you want to run a new image it will spin up a new pod with the new image and shut down the old one.
As shown in the diagram below, a Deployment can manage multiple Pods across multiple Nodes:
Services
Services are used for communication internally within our Kubernetes clusters and externally outside to the web. The service object exposes a consistent IP and port for the microservice. Services help us when we want to call our containers because can use a single point or name, and even if the Pod was shut down due to changes it will be redirected.
The diagram below shows the 3 main entities we just went over. The Pods are running the containers, Deployments are monitoring the Pods, and the Services provide a name or access point.
Demo Application
- Raziel uses a DemoChat application for the demo which you can find here-https://github.com/containers101/demochat
- The application is composed of 2 images, a web server (containers101/demochat:2.0), and Mongo DB (Mongo:latest)
Resources:
- For the purpose of this demo, we use Mini Kube to install Kubernetes locally on our machine – https://github.com/kubernetes/minikube/releases (we also need to have Docker installed)
- https://kubernetes.io/docs/user-guide/prereqs/
Demo
(See demo – 12 minutes 20 seconds of the webinar)
In the live demo Raziel showed us how to do the following:
- Run a Mongo image using a Deployment
- A Pod and Deployment object will be created
- Create a Service to expose the Mongo Pod
- A Service will be created exposing the internal IP for the Mongo Pod
- ‘Mongo’ will be discoverable internally
- Run the demochat web server image
- A Pod and Deployment object will be created
- Create a Service to expose the web server pod
- A Service will be created exposing internally & externally IP for the web server Pod
- Demo chat can be access from the browser
- Scale a web server
- Total of 2 Pods running demochat will be running
Additional Resources
- Sign up for a free account at Codefresh.io & request a one-on-one onboarding session
- Visit our subscribe to our newsletter – https://codefresh.io/blog
- Guide to getting Started with Kubernetes- https://codefresh.io/blog/kubernetes-snowboarding-everything-intro-kubernetes/
- Join our meetup group to attend the next in-person or online event
- Email with questions, feedback, or webinar topic requests at contact@codefresh.io