mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-21 22:07:13 +00:00
Merge branch 'master' into weka
This commit is contained in:
@@ -19,7 +19,7 @@ spec:
|
||||
image: gcr.io/kaniko-project/executor:latest
|
||||
args:
|
||||
- "--context=/workspace/dockercoins/rng"
|
||||
- "--insecure-skip-tls-verify"
|
||||
- "--skip-tls-verify"
|
||||
- "--destination=registry:5000/rng-kaniko:latest"
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
|
||||
@@ -20,8 +20,8 @@ paper_margin: 0.2in
|
||||
engine_version: stable
|
||||
|
||||
# These correspond to the version numbers visible on their respective GitHub release pages
|
||||
compose_version: 1.21.1
|
||||
machine_version: 0.14.0
|
||||
compose_version: 1.22.0
|
||||
machine_version: 0.15.0
|
||||
|
||||
# Password used to connect with the "docker user"
|
||||
docker_user_password: training
|
||||
docker_user_password: training
|
||||
|
||||
@@ -51,7 +51,7 @@ for line in open(sys.argv[1]):
|
||||
|
||||
state.show()
|
||||
|
||||
for chapter in sorted(state.chapters):
|
||||
for chapter in sorted(state.chapters, key=lambda f: int(f.split("-")[1])):
|
||||
chapter_size = sum(state.sections[s] for s in state.chapters[chapter])
|
||||
print("{}\t{}\t{}".format("total size for", chapter, chapter_size))
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ class: extra-details
|
||||
|
||||
- View the secret:
|
||||
```bash
|
||||
kubectl get $SECRET -o yaml
|
||||
kubectl get secret $SECRET -o yaml
|
||||
```
|
||||
|
||||
- Extract the token and decode it:
|
||||
@@ -501,10 +501,14 @@ It's important to note a couple of details in these flags ...
|
||||
```
|
||||
|
||||
- But that we can't create things:
|
||||
```bash
|
||||
```
|
||||
./kubectl run tryme --image=nginx
|
||||
```
|
||||
|
||||
- Exit the container with `exit` or `^D`
|
||||
|
||||
<!-- ```keys ^D``` -->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
@@ -107,6 +107,11 @@ spec:
|
||||
stern build-image
|
||||
```
|
||||
|
||||
<!--
|
||||
```longwait latest: digest: sha256:```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
-v ~/container.training/dockercoins/worker:/workspace \
|
||||
gcr.io/kaniko-project/executor \
|
||||
--context=/workspace \
|
||||
--destination=127.0.0.1:30448/worker-kaniko:latest
|
||||
--destination=127.0.0.1:$PORT/worker-kaniko:latest
|
||||
```
|
||||
|
||||
]
|
||||
@@ -128,7 +128,7 @@ spec:
|
||||
image: gcr.io/kaniko-project/executor:latest
|
||||
args:
|
||||
- "--context=/workspace/dockercoins/rng"
|
||||
- "--insecure-skip-tls-verify"
|
||||
- "--insecure"
|
||||
- "--destination=registry:5000/rng-kaniko:latest"
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
@@ -152,7 +152,7 @@ spec:
|
||||
|
||||
- We use our self-hosted registry DNS name (`registry`)
|
||||
|
||||
- We add `--insecure-skip-tls-verify` since our registry doesn't have TLS certs
|
||||
- We add `--insecure` to use plain HTTP to talk to the registry
|
||||
|
||||
---
|
||||
|
||||
@@ -172,6 +172,11 @@ spec:
|
||||
stern kaniko
|
||||
```
|
||||
|
||||
<!--
|
||||
```longwait registry:5000/rng-kaniko:latest:```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
@@ -335,14 +335,19 @@ We'll cover them just after!*
|
||||
|
||||
.exercise[
|
||||
|
||||
- Go to the `k8s` directory in the repository:
|
||||
```bash
|
||||
cd ~/container.training/k8s
|
||||
```
|
||||
|
||||
- Create a configmap named `haproxy` and holding the configuration file:
|
||||
```bash
|
||||
kubectl create configmap haproxy --from-file=~/container.training/k8s/haproxy.cfg
|
||||
kubectl create configmap haproxy --from-file=haproxy.cfg
|
||||
```
|
||||
|
||||
- Check what our configmap looks like:
|
||||
```bash
|
||||
kuebectl get configmap haproxy -o yaml
|
||||
kubectl get configmap haproxy -o yaml
|
||||
```
|
||||
|
||||
]
|
||||
@@ -384,6 +389,8 @@ spec:
|
||||
kubectl apply -f ~/container.training/k8s/haproxy.yaml
|
||||
```
|
||||
|
||||
<!-- ```hide kubectl wait pod haproxy --for condition=ready``` -->
|
||||
|
||||
- Check the IP address allocated to the pod:
|
||||
```bash
|
||||
kubectl get pod haproxy -o wide
|
||||
@@ -442,7 +449,7 @@ We should see connections served by Google (look for the `Location` header) and
|
||||
|
||||
- Check our configmap:
|
||||
```bash
|
||||
kubectl get configmap regsitry -o yaml
|
||||
kubectl get configmap registry -o yaml
|
||||
```
|
||||
|
||||
]
|
||||
@@ -483,6 +490,8 @@ spec:
|
||||
kubectl apply -f ~/container.training/k8s/registry.yaml
|
||||
```
|
||||
|
||||
<!-- ```hide kubectl wait pod registry --for condition=ready``` -->
|
||||
|
||||
- Check the IP address allocated to the pod:
|
||||
```bash
|
||||
kubectl get pod registry -o wide
|
||||
|
||||
@@ -95,7 +95,7 @@ You'll want the `3xxxx` port.
|
||||
|
||||
- Connect to http://oneofournodes:3xxxx/
|
||||
|
||||
<!-- ```open https://node1:3xxxx/``` -->
|
||||
<!-- ```open http://node1:3xxxx/``` -->
|
||||
|
||||
]
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ The chart's metadata includes an URL to the project's home page.
|
||||
.exercise[
|
||||
|
||||
- Let's install our helm chart! (`dockercoins` is the path to the chart)
|
||||
```bash
|
||||
```
|
||||
helm install dockercoins
|
||||
```
|
||||
]
|
||||
|
||||
@@ -99,6 +99,11 @@ If we wanted to talk to the API, we would need to:
|
||||
curl localhost:8001
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait /version```
|
||||
```keys ^J```
|
||||
-->
|
||||
|
||||
- Terminate the proxy:
|
||||
```bash
|
||||
kill %1
|
||||
@@ -155,7 +160,7 @@ The output is a list of available API routes.
|
||||
|
||||
(and copy credentials, e.g. `~/.kube/config`, to that place)
|
||||
|
||||
- It is even better to use a limited account with reduced permissions
|
||||
- It is even better to use a limited account with reduced permissions
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ Platform:"linux/amd64"}
|
||||
.exercise[
|
||||
|
||||
- Copy the file from `node1`; if you are using macOS or Linux, you can do:
|
||||
```bash
|
||||
```
|
||||
scp `USER`@`X.X.X.X`:.kube/config ~/.kube/config
|
||||
# Make sure to replace X.X.X.X with the IP address of node1,
|
||||
# and USER with the user name used to log into node1!
|
||||
|
||||
@@ -85,6 +85,11 @@ Exactly what we need!
|
||||
stern rng
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait HTTP/1.1```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
@@ -105,6 +110,12 @@ Exactly what we need!
|
||||
```bash
|
||||
stern --tail 1 --timestamps --all-namespaces weave
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait weave-npc```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
@@ -126,4 +137,9 @@ Exactly what we need!
|
||||
stern -l run
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait units of work```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
@@ -200,3 +200,23 @@ Note: it might take a minute or two for the app to be up and running.
|
||||
- the [Kubernetes documentation about network policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/)
|
||||
|
||||
- this [talk about network policies at KubeCon 2017 US](https://www.youtube.com/watch?v=3gGpMmYeEO8) by [@ahmetb](https://twitter.com/ahmetb)
|
||||
|
||||
---
|
||||
|
||||
## Switch back to the default namespace
|
||||
|
||||
- Let's make sure that we don't run future exercises in the `blue` namespace
|
||||
|
||||
.exercise[
|
||||
|
||||
- View the names of the contexts:
|
||||
```bash
|
||||
kubectl config get-contexts
|
||||
```
|
||||
|
||||
- Switch back to the original context:
|
||||
```bash
|
||||
kubectl config use-context kubernetes-admin@kubernetes
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
@@ -188,7 +188,7 @@ spec:
|
||||
|
||||
- Apply another policy:
|
||||
```bash
|
||||
kubectl apply -f ~/container.training/netpol-allow-testcurl-for-testweb.yaml
|
||||
kubectl apply -f ~/container.training/k8s/netpol-allow-testcurl-for-testweb.yaml
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
- Once it's up, check the corresponding pods:
|
||||
```bash
|
||||
kuebectl get pods -l run=yanginx -o yaml | head -n 25
|
||||
kubectl get pods -l run=yanginx -o yaml | head -n 25
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
@@ -180,6 +180,30 @@ If you want to use an external key/value store, add one of the following:
|
||||
|
||||
---
|
||||
|
||||
## Waiting for Portworx to be ready
|
||||
|
||||
- The installation process will take a few minutes
|
||||
|
||||
.exercise[
|
||||
|
||||
- Check out the logs:
|
||||
```bash
|
||||
stern -n kube-system portworx
|
||||
```
|
||||
|
||||
- Wait until it gets quiet
|
||||
|
||||
(you should see `portworx service is healthy`, too)
|
||||
|
||||
<!--
|
||||
```longwait PX node status reports portworx service is healthy```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
## Dynamic provisioning of persistent volumes
|
||||
|
||||
- We are going to run PostgreSQL in a Stateful set
|
||||
@@ -330,6 +354,8 @@ spec:
|
||||
kubectl apply -f ~/container.training/k8s/postgres.yaml
|
||||
```
|
||||
|
||||
<!-- ```hide kubectl wait pod postgres-0 --for condition=ready``` -->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
@@ -347,6 +373,13 @@ spec:
|
||||
kubectl exec -ti postgres-0 su postgres
|
||||
```
|
||||
|
||||
<!--
|
||||
autopilot prompt detection expects $ or # at the beginning of the line.
|
||||
```wait postgres@postgres```
|
||||
```keys PS1="\u@\h:\w\n\$ "```
|
||||
```keys ^J```
|
||||
-->
|
||||
|
||||
- Check that default databases have been created correctly:
|
||||
```bash
|
||||
psql -l
|
||||
@@ -398,6 +431,8 @@ spec:
|
||||
psql demo -c "select count(*) from pgbench_accounts"
|
||||
```
|
||||
|
||||
<!-- ```keys ^D``` -->
|
||||
|
||||
]
|
||||
|
||||
(We should see a count of 1,000,000 rows.)
|
||||
@@ -412,7 +447,7 @@ spec:
|
||||
|
||||
- Check the node running the database:
|
||||
```bash
|
||||
kuebectl get pod postgres-0 -o wide
|
||||
kubectl get pod postgres-0 -o wide
|
||||
```
|
||||
|
||||
]
|
||||
@@ -453,12 +488,14 @@ By "disrupt" we mean: "disconnect it from the network".
|
||||
.exercise[
|
||||
|
||||
- Check that the node can't communicate with other nodes:
|
||||
```bash
|
||||
ping -c 3 node1
|
||||
```
|
||||
ping node1
|
||||
```
|
||||
|
||||
- Logout to go back on `node1`
|
||||
|
||||
<!-- ```keys ^D``` -->>
|
||||
|
||||
- Watch the events unfolding with `kubectl get events -w` and `kubectl get pods -w`
|
||||
|
||||
]
|
||||
@@ -482,11 +519,19 @@ By "disrupt" we mean: "disconnect it from the network".
|
||||
kubectl exec -ti postgres-0 su postgres
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait postgres@postgres```
|
||||
```keys PS1="\u@\h:\w\n\$ "```
|
||||
```keys ^J```
|
||||
-->
|
||||
|
||||
- Check the number of rows in the `pgbench_accounts` table:
|
||||
```bash
|
||||
psql demo -c "select count(*) from pgbench_accounts
|
||||
psql demo -c "select count(*) from pgbench_accounts"
|
||||
```
|
||||
|
||||
<!-- ```keys ^D``` -->
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
@@ -235,7 +235,7 @@ The provided flags:
|
||||
|
||||
- Figure out the NodePort that was allocated to the Prometheus server:
|
||||
```bash
|
||||
kubectl get svc prometheus-server
|
||||
kubectl get svc | grep prometheus-server
|
||||
```
|
||||
|
||||
- With your browser, connect to that port
|
||||
|
||||
@@ -356,6 +356,11 @@ nodes and encryption of gossip traffic) were removed for simplicity.
|
||||
stern consul
|
||||
```
|
||||
|
||||
<!--
|
||||
```wait Synced node info```
|
||||
```keys ^C```
|
||||
-->
|
||||
|
||||
- Check the health of the cluster:
|
||||
```bash
|
||||
kubectl exec consul-0 consul members
|
||||
|
||||
Reference in New Issue
Block a user