diff --git a/kubernetes/deployments/auth.yaml b/kubernetes/deployments/auth.yaml index 0b83cec..364996c 100644 --- a/kubernetes/deployments/auth.yaml +++ b/kubernetes/deployments/auth.yaml @@ -1,9 +1,13 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: auth spec: replicas: 1 + selector: + matchLabels: + app: auth + track: stable template: metadata: labels: diff --git a/kubernetes/deployments/frontend.yaml b/kubernetes/deployments/frontend.yaml index c319306..916a549 100644 --- a/kubernetes/deployments/frontend.yaml +++ b/kubernetes/deployments/frontend.yaml @@ -1,9 +1,13 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: frontend spec: replicas: 1 + selector: + matchLabels: + app: frontend + track: stable template: metadata: labels: diff --git a/kubernetes/deployments/hello-canary.yaml b/kubernetes/deployments/hello-canary.yaml index ef4190e..95b2602 100644 --- a/kubernetes/deployments/hello-canary.yaml +++ b/kubernetes/deployments/hello-canary.yaml @@ -1,9 +1,14 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: hello-canary spec: replicas: 1 + selector: + matchLabels: + app: hello + track: canary + version: 2.0.0 template: metadata: labels: diff --git a/kubernetes/deployments/hello-green.yaml b/kubernetes/deployments/hello-green.yaml index 8c47471..3f1ac80 100644 --- a/kubernetes/deployments/hello-green.yaml +++ b/kubernetes/deployments/hello-green.yaml @@ -1,9 +1,14 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: hello-green spec: replicas: 3 + selector: + matchLabels: + app: hello + track: stable + version: 2.0.0 template: metadata: labels: diff --git a/kubernetes/deployments/hello.yaml b/kubernetes/deployments/hello.yaml index e3315a1..bc8dcd8 100644 --- a/kubernetes/deployments/hello.yaml +++ b/kubernetes/deployments/hello.yaml @@ -1,9 +1,14 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: hello spec: replicas: 3 + selector: + matchLabels: + app: hello + track: stable + version: 1.0.0 template: metadata: labels: diff --git a/labs/creating-and-managing-deployments.md b/labs/creating-and-managing-deployments.md index 268167d..eff994b 100644 --- a/labs/creating-and-managing-deployments.md +++ b/labs/creating-and-managing-deployments.md @@ -17,7 +17,7 @@ You will also define internal services for the `auth` and `hello` deployments an ### Create and Expose the Auth Deployment ``` -kubectl create -f deployments/auth.yaml +kubectl apply -f deployments/auth.yaml --record ``` ``` @@ -31,7 +31,7 @@ kubectl create -f services/auth.yaml ### Create and Expose the Hello Deployment ``` -kubectl create -f deployments/hello.yaml +kubectl apply -f deployments/hello.yaml --record ``` ``` @@ -50,7 +50,7 @@ kubectl create configmap nginx-frontend-conf --from-file=nginx/frontend.conf ``` ``` -kubectl create -f deployments/frontend.yaml +kubectl apply -f deployments/frontend.yaml --record ``` ``` @@ -111,4 +111,4 @@ curl -k https:// ## Summary -Deployments are the preferred way to manage application deployments. You learned how to create, expose and scale deployments. \ No newline at end of file +Deployments are the preferred way to manage application deployments. You learned how to create, expose and scale deployments. diff --git a/labs/install-and-configure-kubectl.md b/labs/install-and-configure-kubectl.md index b0b7054..e232ec9 100644 --- a/labs/install-and-configure-kubectl.md +++ b/labs/install-and-configure-kubectl.md @@ -22,6 +22,24 @@ sudo cp kubectl /usr/local/bin/kubectl ### Configure kubectl +Configure alias and autocomplete Bash: +```.bash +echo "alias k=kubectl" >> ~/.bashrc +echo "source <(kubectl completion bash)" >> ~/.bashrc +echo "complete -F __start_kubectl k" >> ~/.bashrc + +source ~/.bashrc +``` + +Configure alias and autocomplete Zsh: +```.zsh +echo "alias k=kubectl" >> ~/.zshrc +echo "[[ $commands[kubectl] ]] && source <(kubectl completion zsh)" >> ~/.zshrc +echo "complete -F __start_kubectl k" >> ~/.zshrc + +source ~/.zshrc +``` + Download the client credentials and CA cert: ```