From eabd2760ea773fd8e71983b87ed58c077105c2b8 Mon Sep 17 00:00:00 2001 From: b0216282 Date: Thu, 29 Oct 2020 17:12:54 +0530 Subject: [PATCH] More shortcuts --- a.core_concepts.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/a.core_concepts.md b/a.core_concepts.md index b25b5941..6fb670bd 100644 --- a/a.core_concepts.md +++ b/a.core_concepts.md @@ -18,6 +18,7 @@ kubernetes.io > Documentation > Tasks > Access Applications in a Cluster > [Use ```bash kubectl create namespace mynamespace +kubectl create ns mynamespace kubectl run nginx --image=nginx --restart=Never -n mynamespace ``` @@ -35,6 +36,11 @@ Easily generate YAML with: kubectl run nginx --image=nginx --restart=Never --dry-run=client -n mynamespace -o yaml > pod.yaml ``` +Above version 1.19, no need of --restart=Never. Use the following: +```bash +kubectl run nginx --image=nginx --dry-run=client -n mynamespace -o yaml > pod.yaml +``` + ```bash cat pod.yaml ``` @@ -60,6 +66,7 @@ status: {} ```bash kubectl create -f pod.yaml -n mynamespace +kubectl apply if pod.yaml -n mynamespace ``` Alternatively, you can run in one line @@ -68,6 +75,11 @@ Alternatively, you can run in one line kubectl run nginx --image=nginx --restart=Never --dry-run=client -o yaml | kubectl create -n mynamespace -f - ``` +Above version 1.19, remove --restart=Never +```bash +kubectl run nginx --image=nginx --dry-run=client -o yaml | kubectl create -n mynamespace -f - +``` +