diff --git a/k8s/netpol-allow-testcurl-for-testweb.yaml b/k8s/netpol-allow-testcurl-for-testweb.yaml index c0a73f13..0ce8242d 100644 --- a/k8s/netpol-allow-testcurl-for-testweb.yaml +++ b/k8s/netpol-allow-testcurl-for-testweb.yaml @@ -5,7 +5,7 @@ metadata: spec: podSelector: matchLabels: - run: testweb + app: testweb ingress: - from: - podSelector: diff --git a/k8s/netpol-deny-all-for-testweb.yaml b/k8s/netpol-deny-all-for-testweb.yaml index e975991c..1d6b7156 100644 --- a/k8s/netpol-deny-all-for-testweb.yaml +++ b/k8s/netpol-deny-all-for-testweb.yaml @@ -5,6 +5,6 @@ metadata: spec: podSelector: matchLabels: - run: testweb + app: testweb ingress: [] diff --git a/k8s/netpol-dockercoins.yaml b/k8s/netpol-dockercoins.yaml index 79a78f97..1238e14f 100644 --- a/k8s/netpol-dockercoins.yaml +++ b/k8s/netpol-dockercoins.yaml @@ -16,7 +16,7 @@ metadata: spec: podSelector: matchLabels: - run: webui + app: webui ingress: - from: [] diff --git a/k8s/socat.yaml b/k8s/socat.yaml index 5d4b2ca5..fd1d0222 100644 --- a/k8s/socat.yaml +++ b/k8s/socat.yaml @@ -6,7 +6,7 @@ metadata: creationTimestamp: null generation: 1 labels: - run: socat + app: socat name: socat namespace: kube-system selfLink: /apis/extensions/v1beta1/namespaces/kube-system/deployments/socat @@ -14,7 +14,7 @@ spec: replicas: 1 selector: matchLabels: - run: socat + app: socat strategy: rollingUpdate: maxSurge: 1 @@ -24,7 +24,7 @@ spec: metadata: creationTimestamp: null labels: - run: socat + app: socat spec: containers: - args: @@ -49,7 +49,7 @@ kind: Service metadata: creationTimestamp: null labels: - run: socat + app: socat name: socat namespace: kube-system selfLink: /api/v1/namespaces/kube-system/services/socat @@ -60,7 +60,7 @@ spec: protocol: TCP targetPort: 80 selector: - run: socat + app: socat sessionAffinity: None type: NodePort status: diff --git a/slides/k8s/authn-authz.md b/slides/k8s/authn-authz.md index 8e884fbc..def0212f 100644 --- a/slides/k8s/authn-authz.md +++ b/slides/k8s/authn-authz.md @@ -538,7 +538,7 @@ It's important to note a couple of details in these flags ... - But that we can't create things: ``` - ./kubectl run tryme --image=nginx + ./kubectl create deployment --image=nginx ``` - Exit the container with `exit` or `^D` diff --git a/slides/k8s/daemonset.md b/slides/k8s/daemonset.md index cf86bc36..f3bfc54f 100644 --- a/slides/k8s/daemonset.md +++ b/slides/k8s/daemonset.md @@ -256,19 +256,19 @@ The master node has [taints](https://kubernetes.io/docs/concepts/configuration/t - Let's check the logs of all these `rng` pods -- All these pods have a `run=rng` label: +- All these pods have the label `app=rng`: - - the first pod, because that's what `kubectl run` does + - the first pod, because that's what `kubectl create deployment` does - the other ones (in the daemon set), because we *copied the spec from the first one* -- Therefore, we can query everybody's logs using that `run=rng` selector +- Therefore, we can query everybody's logs using that `app=rng` selector .exercise[ -- Check the logs of all the pods having a label `run=rng`: +- Check the logs of all the pods having a label `app=rng`: ```bash - kubectl logs -l run=rng --tail 1 + kubectl logs -l app=rng --tail 1 ``` ] @@ -283,7 +283,7 @@ It appears that *all the pods* are serving requests at the moment. - The `rng` *service* is load balancing requests to a set of pods -- This set of pods is defined as "pods having the label `run=rng`" +- This set of pods is defined as "pods having the label `app=rng`" .exercise[ @@ -310,7 +310,7 @@ to the associated load balancer. -- -- What would happen if we removed the `run=rng` label from that pod? +- What would happen if we removed the `app=rng` label from that pod? -- @@ -322,7 +322,7 @@ to the associated load balancer. -- -- But but but ... Don't we have more than one pod with `run=rng` now? +- But but but ... Don't we have more than one pod with `app=rng` now? -- @@ -345,7 +345,7 @@ to the associated load balancer.
(The second command doesn't require you to get the exact name of the replica set) ```bash kubectl describe rs rng-yyyyyyyy - kubectl describe rs -l run=rng + kubectl describe rs -l app=rng ``` ] @@ -433,11 +433,11 @@ Of course, option 2 offers more learning opportunities. Right? + + +- Create a deployment for this very lightweight HTTP server: + ```bash + kubectl create deployment httpenv --image=jpetazzo/httpenv + ``` + +- Scale it to 10 replicas: + ```bash + kubectl scale deployment httpenv --replicas=10 + ``` ] -The `jpetazzo/httpenv` image runs an HTTP server on port 8888. -
-It serves its environment variables in JSON format. - -The `-w` option "watches" events happening on the specified resources. - --- ## Exposing our deployment @@ -92,12 +110,12 @@ The `-w` option "watches" events happening on the specified resources. - Expose the HTTP port of our server: ```bash - kubectl expose deploy/httpenv --port 8888 + kubectl expose deployment httpenv --port 8888 ``` - Look up which IP address was allocated: ```bash - kubectl get svc + kubectl get service ``` ] @@ -237,7 +255,7 @@ class: extra-details - These IP addresses should match the addresses of the corresponding pods: ```bash - kubectl get pods -l run=httpenv -o wide + kubectl get pods -l app=httpenv -o wide ``` --- diff --git a/slides/k8s/kubectlrun.md b/slides/k8s/kubectlrun.md index ee142a76..eb5d711f 100644 --- a/slides/k8s/kubectlrun.md +++ b/slides/k8s/kubectlrun.md @@ -173,6 +173,11 @@ pod/pingpong-7c8bbcd9bc-6c9qz 1/1 Running 0 10m kubectl scale deploy/pingpong --replicas 8 ``` +- Note that this command does exactly the same thing: + ```bash + kubectl scale deployment pingpong --replicas 8 + ``` + ] Note: what if we tried to scale `replicaset.apps/pingpong-xxxxxxxxxx`? diff --git a/slides/k8s/logs-cli.md b/slides/k8s/logs-cli.md index 3d540304..e4a4f179 100644 --- a/slides/k8s/logs-cli.md +++ b/slides/k8s/logs-cli.md @@ -130,11 +130,13 @@ Exactly what we need! - We can use that property to view the logs of all the pods created with `kubectl run` +- Similarly, everything created with `kubectl create deployment` has a label `app` + .exercise[ -- View the logs for all the things started with `kubectl run`: +- View the logs for all the things started with `kubectl create deployment`: ```bash - stern -l run + stern -l app ```