Here is a cheat sheet of common DevOps tools and commands with examples:
Tools
- Git: A version control system for tracking changes to files.
- Docker: A containerization platform for building and running applications in isolated environments.
- Kubernetes: An orchestration platform for managing containerized applications.
- Terraform: An infrastructure as code (IaC) tool for automating the provisioning and management of infrastructure resources.
- Ansible: A configuration management tool for automating the configuration of servers and other systems.
- Jenkins: A continuous integration (CI) and continuous delivery (CD) tool for automating the building, testing, and deployment of software.
Commands
- git clone <url>: Clone a remote Git repository to your local machine.
- git checkout <branch>: Switch to a different branch in Git.
- git push <remote> <branch>: Push the local branch to the remote repository.
- git pull <remote> <branch>: Pull the remote branch to the local repository.
- docker build -t <image name> <directory>: Build a Docker image from a directory.
- docker run -d -p <port>:<port> <image name>: Run a Docker image in detached mode, publishing the specified port to the host.
- kubectl get pods: List all Kubernetes pods.
- kubectl apply -f <file name>: Apply a Kubernetes manifest file.
- terraform init: Initialize Terraform.
- terraform plan: Show the changes that Terraform would make to the infrastructure.
- terraform apply: Apply the changes planned by Terraform.
- ansible-playbook <playbook name>.yml: Run an Ansible playbook.
- jenkins job build: Build a Jenkins job.
Example:
To build a Docker image from a directory and run it in detached mode, publishing port 80 to the host:
docker build -t my-image .
docker run -d -p 80:80 my-image
To apply a Kubernetes manifest file:
kubectl apply -f my-deployment.yml
To initialize Terraform and plan the changes that would be made to the infrastructure:
terraform init
terraform plan
To apply the changes planned by Terraform:
terraform apply
To run an Ansible playbook:
ansible-playbook my-playbook.yml
To build a Jenkins job:
jenkins job build
These are just a few examples of the many DevOps tools and commands available. For more information, please see the documentation for the specific tools that you are using.
No comments:
Post a Comment