Module 15 of 16 · 📖 4 min read · ⏱ 30 min total
FI-AE 15 DevOps — CI-CD-Pipelines und Container (EN)
Table of contents (6 sections)
FI-AE 15 DevOps — CI/CD-Pipelines and Containers
In this module, you will learn the fundamentals of modern software deployment through CI/CD pipelines and containerization. You will understand how automated build, test, and deployment processes accelerate and stabilize development. Additionally, you will acquire practical knowledge in Docker and Kubernetes to operate applications in a scalable and portable manner.
Concepts and Background
- CI/CD Pipeline
- An automated process that guides code changes through build, test, and deployment steps to ensure continuous integration and deployment.
- Docker
- A platform for containerizing applications that bundles dependencies and ensures a consistent environment across different systems.
- Kubernetes
- An open-source system for automating the deployment, scaling, and management of containerized applications.
- Pod
- The smallest deployable unit in Kubernetes, which includes one or more containers with shared network and storage.
- Deployment
- A Kubernetes object that declares how an application should be run and is responsible for managing ReplicaSets.
Architecture Diagram
flowchart LR A[Developer] --> B[Git Repository] B --> C[CI/CD Server] C --> D[Docker Registry] D --> E[Kubernetes Cluster] E --> F[Production Environment] C --> G[Test Environment]
Practical Steps
- Install Docker on your system with the command
to create and manage containers.sudo apt install docker.io - Create a Dockerfile with a base image instruction like
to define your application environment.FROM ubuntu:20.04 - Build your Docker image with
to compile your application into a container image.docker build -t my-app:latest . - Push the image to a registry with
to make it available in the cluster.docker push my-app:latest - Create a Kubernetes deployment manifest with
to deploy your application in the cluster.kubectl apply -f deployment.yaml - Create a service with
to enable access to your application.kubectl expose deployment my-app --port 80 - Implement a CI/CD pipeline with Jenkins or GitLab CI to automate builds and deployments.
- Configure a health check in your deployment to ensure the availability of your application.
Common Pitfalls
Further Resources
- Official Docker Documentation
- Kubernetes Official Documentation
- Jenkins Pipeline Documentation
- GitLab CI/CD YAML Documentation
- Kubernetes Pod Concept
Knowledge Check
Four questions for self-assessment. Click on each question to see the correct answer and explanation.
What is the main advantage of a CI/CD pipeline in software development?
- A) Reduction of the number of developers in the team
- B) Automation of build, test, and deployment processes
- C) Increase in code complexity
- D) Reduction of documentation requirements
Correct Answer: B. CI/CD pipelines automate build, test, and deployment processes, which accelerates and stabilizes development. Option A is incorrect as the number of developers is not reduced. Option C is incorrect as code complexity is not increased. Option D is incorrect as documentation requirements are not reduced.
What is a Pod in Kubernetes?
- A) A container orchestration system
- B) The smallest deployable unit in Kubernetes
- C) A storage object for persistent data
- D) A network plugin for Kubernetes
Correct Answer: B. A Pod is the smallest deployable unit in Kubernetes, which includes one or more containers with shared network and storage. Option A is incorrect as Kubernetes is the container orchestration system. Option C is incorrect as PersistentVolume and other objects are used for persistent data. Option D is incorrect as network plugins are provided by other components.
Which command creates a Docker image from a Dockerfile?
- A) docker create -t my-app:latest
- B) docker run -t my-app:latest
- C) docker build -t my-app:latest
- D) docker deploy -t my-app:latest
Correct Answer: C. The command 'docker build -t my-app:latest' creates a Docker image from a Dockerfile. Option A is incorrect as 'docker create' creates a container, not an image. Option B is incorrect as 'docker run' starts a container, it does not create an image. Option D is incorrect as 'docker deploy' is not a valid Docker command.
What is the main task of Kubernetes?
- A) Code versioning and management
- B) Containerization of applications
- C) Automation of deployment, scaling, and management of containerized applications
- D) Creation of Docker images
Correct Answer: C. Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications. Option A is incorrect as code versioning and management is handled by systems like Git. Option B is incorrect as containerization is handled by Docker. Option D is incorrect as Docker image creation is handled by Docker.