DevOps Cheat Sheet

DevOps involves a set of practices that aim to automate and improve the collaboration between development and operations teams. Below is a concise DevOps cheat sheet covering key concepts, tools, and practices:

DevOps Principles

  1. Collaboration:
    • Foster communication and collaboration between development and operations teams.
  2. Automation:
    • Automate repetitive tasks for efficiency.
    • Use Continuous Integration (CI) and Continuous Deployment (CD) pipelines.
  3. Infrastructure as Code (IaC):
    • Manage infrastructure using code (e.g., Terraform, Ansible, Chef, Puppet).
  4. Monitoring and Logging:
    • Implement robust monitoring and logging practices for quick issue detection and resolution.
  5. Continuous Feedback:
    • Provide feedback loops for continuous improvement.

Version Control

Git Commands:

git clone <repository_url>
git add .
git commit -m "Commit message"
git pull
git push

Continuous Integration (CI)

  • CI Tools:
    • Jenkins, GitLab CI, Travis CI, CircleCI
  • CI Configuration (Example – GitLab CI):
stages:
  - build
  - test

build_job:
  script:
    - echo "Building..."

test_job:
  script:
    - echo "Testing..."

Continuous Deployment (CD)

  • CD Tools:
    • Kubernetes, Docker, Ansible, Helm

Containerization

  • Docker Commands:
docker build -t image_name .
docker run -p host_port:container_port image_name
docker push image_name

Here is a dedicated Docker Commands Cheat Sheet.

Orchestration

  • Kubernetes Commands:
kubectl apply -f deployment.yaml
kubectl get pods
kubectl logs pod_name

Infrastructure as Code (IaC):

  • Terraform Commands:
terraform init
terraform plan
terraform apply

Configuration Management

  • Ansible Commands:
ansible-playbook playbook.yml

Monitoring

  • Monitoring Tools:
    • Prometheus, Grafana, ELK Stack (Elasticsearch, Logstash, Kibana)

Collaboration and Communication

  • ChatOps Tools:
    • Slack, Microsoft Teams

Security

  • Security Scanning Tools:
    • OWASP Dependency-Check, SonarQube, Clair

Cloud Providers

  • AWS CLI:
aws s3 ls
aws ec2 describe-instances
  • Azure CLI:
az storage account list
az vm list

This cheat sheet provides a quick reference for key DevOps concepts, tools, and commands. Keep in mind that the DevOps landscape is vast, and you may need to tailor this cheat sheet to your specific tools and practices. Always refer to the official documentation of the tools you are using for detailed information.