kasramp / cheat-sheet-factory

A collection of useful cheat sheets for computer related stuff
http://cheatsheetfactory.geekyhacker.com
MIT License
11 stars 10 forks source link

Cheatsheet request: docker (pull, container, run, image, etc.) #4

Closed VltraHeaven closed 3 years ago

VltraHeaven commented 5 years ago

If you would like to give me a template of the outline you use to make your cheat sheets, I can commit a few cheat sheets on docker commands.

kasramp commented 5 years ago

Hi @VltraHeaven. You can use the following template:

https://raw.githubusercontent.com/kasramp/cheat-sheet-factory/gh-pages/container/kubectl.md

---
title: kubectl
category: Container
layout: 2017/sheet
updated: 2019-04-17
keywords:
    - "kubectl"
    - "Kubernetes kubectl"
prism_languages: [bash]
intro: |
  Kubectl cheat sheet
---

Shortcuts
---------
{: .-one-column}

### Section 1

| `command name with switches` | A brief description |
| `Another command` | Another brief description |
.....

### Section 2

Example of using syntax highlighting with `bash`

"```bash"
"$ ls -shlrt"
"```"
remove `"`

### Section 3 (example of links)

[https://kubernetes.io/docs/reference/kubectl/cheatsheet/](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)

[https://github.com/dennyzhang/cheatsheet-kubernetes-A4](https://github.com/dennyzhang/cheatsheet-kubernetes-A4)

For Docker just create a .md file based on the given template at https://github.com/kasramp/cheat-sheet-factory/tree/gh-pages/container path

Let me know if you have any questions

VltraHeaven commented 5 years ago

Sounds good. Thank you!

Sent from ProtonMail Mobile

On Mon, Jun 17, 2019 at 11:11 PM, Kasra Madadipouya notifications@github.com wrote:

Hi @VltraHeaven. You can use the following template:

https://raw.githubusercontent.com/kasramp/cheat-sheet-factory/gh-pages/container/kubectl.md


title: kubectl category: Container layout: 2017/sheet updated: 2019-04-17 keywords:

  • "kubectl"
  • "Kubernetes kubectl" prism_languages: [bash] intro: | Kubectl cheat sheet

Shortcuts

{: .-one-column}

Handy kubectl commands

| kubectl get pods -n [namespace] | List pods | | kubectl get pods -o wide -n [namespace] | List pods with nodes information | | kubectl logs -n [namespace] [podname] -f | Tail logs for a pod in a namespace | | kubectl logs -n [namespace] [podname] -p | Get logs for a previous deployment | | kubectl config view | Show configurations | | kubectl config view | Show configurations | | kubectl get services | List all services in the namespace | | kubectl get pods --all-namespaces | List all pods in all namespaces | | kubectl get deployment my-dep | List a particular deployment | | kubectl scale --replicas=3 rs/foo | Scale a replicaset named 'foo' to 3 | | kubectl delete pods [pod] | Delete a pod | | kubectl delete pods [pod] --grace-period=0 --force | Force delete a pod | | kubectl exec -it [pod] /bin/bash | SSH to a pod | | kubectl port-forward [pod] 8888:8080 -n [namespace] | Port forwarding | | kubectl create --dry-run --validate -f pod-dummy.yaml -n [namespace] | Dry run of pod | | kubectl -n [namespace] scale deployment [podname] --replicas=0 | Scale down to zero instances | | kubectl -n [namespace] scale deployment [podname] --replicas=2 | Scale to two instances | | kubectl -n [namespace] get deployment [servicename] -o yaml | Get deployment details | | kubectl -n [namespace] get pods --watch | Watch pods | | kubectl -n [namespace] exec [podname] env | Get pod environment variables | | kubectl -n [namespace] top pod | Get pods resource usage | | kubectl -n [namespace] delete pod [podname] | Delete a pod | | kubectl -n [namespace] delete pod [podname] --grace-period=0 --force | Force delete a pod | | kubectl -n [namespace] get ingresses | Get ingresses list | | kubectl -n [namespace] edit deployment [servicename] | Edit deployment, good for resource changes without downtime | | kubectl -n [namespace] edit hpa [servicename] | Change horizontal scaling setting without downtime | | kubectl -n [namespace] get secret | Get secret list | | kubectl -n [namespace] get secret --export -o yaml [secretname] > ~/secret.txt | Export a secret | | kubectl -n [namespace] create secret generic [secretname] --from-file=~/secret.txt | Create a secret |

Kubectl config for multiple clusters


export KUBECONFIG='stage-cluster.kubeconfig:prod-cluster.kubeconfig' # export kube configs for multiple clusters
kubectl config get-contexts # get list of contexts
kubectl config current-context # get current context in use
kubectl config use-context stage-cluster # switch to `stage-cluster` context
kubectl config use-context prod-cluster # switch to `prod-cluster` context

Reference

https://kubernetes.io/docs/reference/kubectl/cheatsheet/

https://github.com/dennyzhang/cheatsheet-kubernetes-A4

For Docker just create a .md file based on the given template at https://github.com/kasramp/cheat-sheet-factory/tree/gh-pages/container path

Let me know if you have any questions

—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](https://github.com/kasramp/cheat-sheet-factory/issues/4?email_source=notifications&email_token=AK3YAQI2XUGQDFKDVBKJIP3P3B4CVA5CNFSM4HYVILQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX5JOXQ#issuecomment-502962014), or [mute the thread](https://github.com/notifications/unsubscribe-auth/AK3YAQIACWS4UHNDT7JARY3P3B4CVANCNFSM4HYVILQQ).
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xsBNBFuinfwBCACW8n2CEtFAI5YDRp3CctYLX88uZPTImVRKOW7SgTfUik1zxFwV EK+UVMnQpeajokNrxeRV+rq1hgbVliQ+gVWY8m+H40r6hANyVM8sdIpbi0R+Q7i9 ZmZjWPgpTZEdL3pzpq2YpY9AseZZzUFXBt7IES8Fc211PPbaWAqmUVtEOgt/WeT+ 4KvZO6I+sR/G0HJUiSMpMfCV6ckKH5nrhZJ2F3erLEIGTrK8Kw6BkITDVWGMxxgH qCQYrbPZGmqspF+cmA22fERpR/IcF3V4sHI38+L2D1g8BQDqHTTDJXdn18ABt00j lRAN9mWn+MMilN+WQ2QaT0p/kK38oALsVXyjABEBAAHNOSJWbHRyYUhlYXZlbkBw cm90b25tYWlsLmNvbSIgPFZsdHJhSGVhdmVuQHByb3Rvbm1haWwuY29tPsLAfwQQ AQgAKQUCW6Kd/AYLCQcIAwIJEBe9w3ZWzjw/BBUICgIDFgIBAhkBAhsDAh4BAAoJ EBe9w3ZWzjw/9psH/RoOYn/bKdq6gd1o7huO8LL09wvjgOfAsc4YiadKiliTeEs6 aTjfPtxHgXckb5YEOt8bGfbdo8XrDg/IFKVZSz9vDb8P8hJdSsONAk0Ttnodt6Ly OsHU2BfnDTU3eO5Lk1YrcVInEJw6oCnWEXoZCZFxqEqFQ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