# Demystifying DevOps

### DevOps team

That takes care of the entire SDLC life cycle - build deploy and monitor.

### Component of DevOps infinity loop

* Plan
    
* Code
    
* Build
    
* Test
    
* Release
    
* Deploy
    
* Operate
    
* Monitor
    

### Objective of DevOps

To automate repeatable tasks as much as possible.

### Continuous Integration (CI)

* Frequently merging codes changes from multiple developers into a repo
    
* Automated build and test are run to provide real-time feedback\]
    
* Aim :- To minimize bugs within the code early within the cycle
    

### Continuous Delivery (CD)

* Ship software to production environment.
    
* CD pipeline -&gt; build changes -&gt; packages -&gt; run integration and system tests.
    
* After approval -&gt; deploy changes to your test & production environments.
    

### Infrastructure as Code (IAC)

* Managing and provisioning infrastructure using code and configuration files.
    
* Build infrastructure through API calls and templates.
    

### Configuration as code (CaC)

* Managing and provisioning configuration settings using code and version control systems.
    

### Monitoring and logging

* Involves capturing and analyzing data about the behavior and performance of software applications and systems.
    
* Aim:- to identify issues, troubleshoot problems and make informed decisions for improvement.
    

### Cloud-native applications

* Scalability, flexibility and resilient (fault-tolerant)
    
* Microservices architecture
    
* Containerization :- consistent, portable, lightweight environment for applications to run; Build once, run anywhere and the Package once, deploy anywhere
    
    * Contains required libraries and dependencies.
        
    * Containers do not inherit the OS environment variables, we have to set them separately.
        
    * Containers were designed to use Linux namespaces to provide isolation and cgroups to offer restrictions on CPU, memory, and disk I/O consumption.
        
* Dynamic orchestration.
    

### Containers

* Consistent, portable, lightweight environment for applications to run; Build once, run anywhere and the Package once, deploy anywhere
    
* Contains required libraries and dependencies.
    
* Containers do not inherit the OS environment variables, we have to set them separately.
    
* Containers were designed to use Linux namespaces to provide isolation and cgroups to offer restrictions on CPU, memory, and disk I/O consumption.
    
* Container networking
    
    * SDN :- Software-defined networks.
        
    * None :- Fully isolated network; assigned to loopback interface.
        
    * Bridge :- default network in most container runtimes
        
        * Uses `docker0` interface.
            
        * NAT between the container and host network - allows external network connectivity.
            
        * Does not result in port conflict.
            
        * multiple containers can use the same container port.
            
        * Containers can communicate within single host using container IP address.
            
        * Best practice :- Don't bridge network for clustered configuration.
            
    * Host
        
        * Ues the network namespace of the host machine for all the containers.
            
        * Prone to port-conflict issues
            
        * No network isolation between container (a potential security issue)
            
    * Underlay
        
        * Underlay exposes the host network interfaces directly to containers.
            
        * Example :- assign a MAC address to every container.
            
    * Overlay
        
        * Overlay networks allow communication between containers on different host machines via a networking tunnel.
            
    * Containers inherit the host OS's DNS settings
        
    * Docker containers do not inherit entries in the /etc/hosts files
        
* Container build and deployment workflow
    
    * Code app.
        
    * Create a `Dockerfile` - contains steps to install application dependencies and environment configurations.
        
    * Using Dockerfile
        
        * Build container image.
            
        * Run container image.
            
        * Unit test the app running on the container.
            
    * Push image to registry.
        
    * Create containers from container images.
        
* Migration to containers?
    
    * Stateless relative easy to containerize.
