Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
abregman committed Oct 23, 2022
1 parent 65b0e6f commit c9cfbf9
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ Name | Comments

## Blogs & News

DevOps & Software Engineering related blogs

Name | Description
:------|:------:
[Spacelift Blog](https://spacelift.io/blog) | Excellent tech blog on Kubernetes, Ansible, Terraform and Engineering in general
[opensource.com](https://opensource.com) | open source related articles including DevOps
[CooperPress](https://cooperpress.com/publications) | various newsletters on different topics
[afreshcup](https://afreshcup.com) | "covering Ruby on Rails and whatever else I find interesting in the universe of software"
Expand Down
24 changes: 24 additions & 0 deletions resources/argocd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ArgoCD

## Commands

* login: `argocd login <ADDRESS>`
* version: `argocd version`

### Apps

* create an application:

```
argocd app create {APP NAME} \
--project {PROJECT} \
--repo {GIT REPO} \--path {APP FOLDER} \
--dest-namespace {NAMESPACE} \
--dest-server {SERVER URL}
```
* app list: `argocd app list`
* app detailed info: `argocd app get <APP NAME>`

* sync app: `argocd app sync <APP NAME>`
* app history: `argocd app history <APP NAME>`
* delete app: `argocd app delete <APP NAME>`
19 changes: 19 additions & 0 deletions resources/containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ Name | Description

* List images: `podman image ls`
* Pull latest ubuntu image: `podman image pull ubuntu:latest`
* Remove image from the host: `podman rmi IMAGE`
* Remove all images: `podman rmi -a` or the more extreme version of it: `podman rmi $(podman images -qa) -f`
* Login to Red Hat registry: `podman login registry.redhat.io`
* List all available tags for a given image using the CLI: `podman search --list-tags IMAGE_NAME`
* List all available tags for a given image using an API request: `curl -Ls https://SERVER/v2/.../tags/list | python -m json.tool`
* Create an archive from the image: `podman save -o some_image.tar IMAGE`
* Load image from the archive: `podman load -i some_image.tar`
* List added/modified/deleted files on container's image filesystem: `podman diff IMAGE_NAME`
* List of mounted files for a running container: `podman inspect -f "{{range .Mounts}}{{println .Destination}}{{end}}" CONTAINER_NAME/ID`
* Commit changes to another image: `podman commit EXISTING_IMAGE NEW_IMAGE`

#### Registries

* List all repositories in a registry: `curl -Ls https://SERVER/v2/_catalog?n=`
* List all repositories in a registry and convert to JSON: `curl -Ls https://SERVER/v2/_catalog?n=3 > | python -m json.tool`

#### Security

Expand Down Expand Up @@ -103,3 +118,7 @@ chmod 0400 ca-k.pem client-key.pem daemon-key.pem && chmod -v 0444 ca.pem client
"tlskey": "/home/ubuntu/.docker/key.pem"
}
```

#### Cleanup

* Remove everything: `podman system reset`
1 change: 1 addition & 0 deletions resources/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Name | Comments
* List branches: `git branch`
* Update based on status of remote branches: `git remote prune origin`
* Delete local branch: `git branch -d some-branch`
* What are the changes if merging branch y into x: `git merge-tree $(git merge-base x y) x y`

#### Staging

Expand Down
1 change: 1 addition & 0 deletions resources/gitops.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://opengitops.dev
19 changes: 19 additions & 0 deletions resources/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ Name | Comments
* Cluster information: `kubectl cluster-info`
* List nodes: `kubectl get nodes`

### Images

* List all containers images from all namespaces:

```
kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c
```

### Pods

* List of Pods in current namespace: `kubectl get po`
Expand All @@ -131,6 +142,10 @@ POD_NAME=$(kubectl get pod \
| tail -1)
```

* Get pods sorted by time creation: `kubectl get pods --sort-by='{.metadata.creationTimestamp}'`
* Run long/endless running container: `kubectl run test --image ubuntu -- sleep 2000000000`
* Get a shell access to a container: `kubectl exec --stdin --tty some-shell -- /bin/bash`

### User

* Creating a new user
Expand Down Expand Up @@ -181,3 +196,7 @@ alias kgsvcslwn='watch kubectl get service --show-labels --namespace'
krmgf nginx-8jk71 # kill pod nginx-8jk71 using grace period 0 and force
```

### Monitoring

* Install metrics-server using Minikube: `minikube addons enable metrics-server`
41 changes: 32 additions & 9 deletions resources/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ Name | Comments
[Techmint Linux](https://www.tecmint.com/free-online-linux-learning-guide-for-beginners) | Written articles/lessons
[Linux Survival](https://linuxsurvival.com/linux-tutorial-introduction) | Interactive guide
[NixCraft](https://www.cyberciti.biz/) | Succinct guides

## Learn Linux - Articles

Name | Comments
:------|:------:
[Linux Filesystem Explained](https://www.linux.com/training-tutorials/linux-filesystem-explained) | NSIA
[Linux SysOps Handbook](https://abarrak.gitbook.io/linux-sysops-handbook) | A study notes book for the common knowledge and tasks of a Linux system admin.


## Linux Internals - Articles

Expand Down Expand Up @@ -71,7 +68,23 @@ Andrew McNico | [tcpdump](https://www.slideshare.net/j0b1n/tcpdump-hunter?qid=b7

## Cheat Sheet

#### SElinux
### Common Operations

* Copy files to a remote host: `rsync -azv dir USER:REMOTE_HOST_ADDR`
* View file size: `du -sh DIR/FILE`

### Users

* Who is connected: `w`

### Troubleshooting and Debugging

* see list of processes and the CPU and memory the consume: `top`
* show how long the server is up running: `uptime`
* List open files: `lsof`
* List open connections: `lsof -i`

### SElinux

Get SElinux denials

Expand All @@ -81,7 +94,11 @@ semodule -DB
sudo ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today
```

#### Tmux
### Communication

* Broadcast a message to everyone: `wall`

### Tmux

* Join a session `tmux a`
* Attach to existing session: `tmux attach -t <SESSION_NAME>`
Expand Down Expand Up @@ -111,13 +128,19 @@ sudo ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today
* Sort files by size: `ls -l | sort -nk5`
* Find broken links: `find /some/path -type l -exec test ! -e {} \; -print`

#### YAML
### LDAP

* LDAP search for a username: `ldapsearch -x -W -D username`
* LDAP search for a username specifying DC and ldap server: `ldapsearch -x -H ldap://ldap.blabla.com -LLL -b 'dc=DOMAIN,dc=com' "rhatNickName=abregman"`

### YAML

* Validate YAML file with Ruby: `ruby -ryaml -e "p YAML.load(STDIN.read)" < some_file.yaml`
* Validate YAML file with Python: `pip install pyyaml; python -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < some_file.yaml`

#### Misc
### Misc

* Random string of 7 characters: `mkpasswd -l 8`
* Generate 8 digit random number: `shuf -i 9999999-99999999 -n 1`

## Checklist
Expand Down

0 comments on commit c9cfbf9

Please sign in to comment.