Skip to content

Instantly share code, notes, and snippets.

@inductor
Created June 4, 2021 11:02
Show Gist options
  • Save inductor/f0fc1ed12f6955f469c054ff0e532c1f to your computer and use it in GitHub Desktop.
Save inductor/f0fc1ed12f6955f469c054ff0e532c1f to your computer and use it in GitHub Desktop.
git diff origin/release-1.18 origin/release-1.19 <file>
diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md
index e20826ca4..ab4fde546 100644
--- a/content/en/docs/reference/kubectl/cheatsheet.md
+++ b/content/en/docs/reference/kubectl/cheatsheet.md
@@ -90,6 +90,13 @@ kubectl apply -f ./my1.yaml -f ./my2.yaml # create from multiple files
kubectl apply -f ./dir # create resource(s) in all manifest files in dir
kubectl apply -f https://git.io/vPieo # create resource(s) from url
kubectl create deployment nginx --image=nginx # start a single instance of nginx
+
+# create a Job which prints "Hello World"
+kubectl create job hello --image=busybox -- echo "Hello World"
+
+# create a CronJob that prints "Hello World" every minute
+kubectl create cronjob hello --image=busybox --schedule="*/1 * * * *" -- echo "Hello World"
+
kubectl explain pods # get the documentation for pod manifests
# Create multiple YAML objects from stdin
@@ -304,6 +311,7 @@ kubectl run nginx --image=nginx # Run pod nginx and write it
kubectl attach my-pod -i # Attach to Running Container
kubectl port-forward my-pod 5000:6000 # Listen on port 5000 on the local machine and forward to port 6000 on my-pod
kubectl exec my-pod -- ls / # Run command in existing pod (1 container case)
+kubectl exec --stdin --tty my-pod -- /bin/sh # Interactive shell access to a running pod (1 container case)
kubectl exec my-pod -c my-container -- ls / # Run command in existing pod (multi-container case)
kubectl top pod POD_NAME --containers # Show metrics for a given pod and its containers
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment