Errata

Kubernetes Best Practices

Errata for Kubernetes Best Practices

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Chapter 1
Code example

In the Deployment manifest at the beginning of Chapter 1, `request` should be `requests`:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# ...
spec:
# ...
containers:
- image: my-repo/journal-server:v1-abcde
imagePullPolicy: IfNotPresent
name: frontend
resources:
request: <========
cpu: "1.0"
memory: "1G"
limits:
cpu: "1.0"
memory: "1G"

Note from the Author or Editor:
The follow field needs to be updated to requests on page 11 in the code snippet

---
resources:
requests: <========
cpu: "1.0"
memory: "1G"
---

Daniel Weibel  Nov 11, 2019  Jul 10, 2020
Chapter 1
Around Deployment manifest

The label of the Deployment is `app: frontend`, but it is referred in the text as `layer: frontend `.

Should be changed to `app: frontend`.

Note from the Author or Editor:
The following sentence on page 5 should read:

We’ve added the `app: frontend` label to all of these resources so that
we can examine all resources for a particular layer in a single request.

Daniel Weibel  Nov 11, 2019  Jul 10, 2020
1
Chapter 1, Section Creating a TCP Load Balancer by Using Services, headless service

The example creates a headless service called "redis-write. The books mentions connecting to "redis-0.redis" for writes. It should read "redis-0.redis-write"

Kubernetes will create a DNS entry for <pod-name>.<service-name>

Note from the Author or Editor:
Page 15 - last paragraph should be updated from "redis-0.redis" to "redis-0.redis-write"

Max Renaud  Apr 16, 2020  Jul 10, 2020
Printed
Page 2
Figure 1-1

In "Figure 1-1. An application diagram" there should be down arrows connecting "Static File Server Service" to "Static File Pod" which should look the same as the connecting arrows from "API Server Service" to "API Pod"

Note from the Author or Editor:
In "Figure 1-1. An application diagram" there should be down arrows connecting "Static File Server Service" to "Static File Pod" which should look the same as the connecting arrows from "API Server Service" to "API Pod"

Lachlan Evenson  Dec 18, 2019  Jul 10, 2020
Printed
Page 3
3rd paragraph

The word folder and directory are used interchangeably in the first and second sentence in the 3rd paragraph. I would suggest changing "folder organization" to "directory organization"

Note from the Author or Editor:
Fixed in the atlas repo.

Lachlan Evenson  Dec 18, 2019  Jul 10, 2020
9
Figure 9-1

Figue 9-1 shows two containers in the same pod binding to port 80.
The networking namespace is per pod; not containers so they cannot both bind to port 80. Figure 9-2 shows this correctly as they bind to different ports.

Note from the Author or Editor:
Container A in Figure 9-1 should be updated to "Port 443"

Max Renaud  Apr 16, 2020  Jul 10, 2020
9
Figure 9-2

Figure 9-2 shows three pods on two different nodes. All the pods have the same IP: 172.22.0.12
Pods should have different IPs. Also note that by default Kubernetes will assign a /24 (for 110 pods) per node so Node1 should be 172.22.1.12 or something equivalent.

Note from the Author or Editor:
The bottom left Pod should have it's Pod IP updated to 172.22.0.13 and the middle right Pod should have it's Pod IP updated to 172.23.0.12

Max Renaud  Apr 16, 2020  Jul 10, 2020
Printed
Page 10
First YAML block, middle of the page

In the YAML block:

...
volumes:
- name: passwd-volume
secret:
secretName: redis-passwd

the key "secretName" should be indented:

...
volumes:
- name: passwd-volume
secret:
secretName: redis-passwd

Note from the Author or Editor:
It should be intended with the same indentation on the last 4 lines of
the YAML block on page 11

Luca Terzi  Nov 04, 2020 
Printed
Page 13
second block of example code showing the redis startup script

The hashbang at the head of the file should be `#!/bin/sh` as bash does not exist on the alpine container, so #!/bin/bash does not work.

Note from the Author or Editor:
Corrected in the atlas repo.

Peter Stratton  Jan 30, 2020  Jul 10, 2020
Printed
Page 17
1st YAML block

All cases of frontend need to be updated to fileserver as follows:

```yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: fileserver
name: fileserver
namespace: default
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: fileserver
sessionAffinity: None
type: ClusterIP
```

Also, the 2nd YAML block needs to be updated as follows (change serviceName from nginx to fileserver):

```yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: frontend-ingress
spec:
rules:
- http:
paths:
- path: /api
backend:
serviceName: frontend
servicePort: 8080
# NOTE: this should come after /api or else it will hijack requests
- path: /
backend:
serviceName: fileserver
servicePort: 80
```

Note from the Author or Editor:
All cases of frontend need to be updated to fileserver as follows:

```yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: fileserver
name: fileserver
namespace: default
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: fileserver
sessionAffinity: None
type: ClusterIP
```

Also, the 2nd YAML block needs to be updated as follows (change serviceName from nginx to fileserver):

```yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: frontend-ingress
spec:
rules:
- http:
paths:
- path: /api
backend:
serviceName: frontend
servicePort: 8080
# NOTE: this should come after /api or else it will hijack requests
- path: /
backend:
serviceName: fileserver
servicePort: 80
```

Lachlan Evenson  Dec 18, 2019  Jul 10, 2020
Printed
Page 22
2nd paragraph

The following sentence has a grammar error:

This is the day-to-day activities of the developer.

Should be either

This is the day-to-day activity of the developer.

OR

These are the day-to-day activities of the developer.

Note from the Author or Editor:
The following sentence "This is the day-to-day activities of the developer." Should read "This is the day-to-day activity of the developer."

Lachlan Evenson  Dec 18, 2019  Jul 10, 2020
Printed
Page 25
2nd paragraph from the bottom

The following command needs to be updated

From:
```sh
go run csr-gen.go client <user-name>
```
To:

```sh
go run csr-gen.go client <user-name>;
```

Note from the Author or Editor:
From:
```sh
go run csr-gen.go client &lt;user-name&gt;
```
To:

```sh
go run csr-gen.go client <user-name>;
```

Lachlan Evenson  Dec 18, 2019  Jul 10, 2020
35
none

Submitting script as a ConfigMap:

kubectl create configmap redis-config --from-file=launch.sh=launch.sh

should be

kubectl create configmap redis-config --from-file=./launch.sh

Note from the Author or Editor:
I see this on page 13 of the Deploying a simple stateful database

Avishay Saban  Nov 25, 2019  Jul 10, 2020
Printed
Page 36
Last paragraph

"Another monitoring approach, [...] was popularized by Tom Willke."

I think the name of the author of the RED method is wrong. It is not Tom Willke, the correct name is Tom Wilkie. See for example https://www.weave.works/blog/the-red-method-key-metrics-for-microservices-architecture/.

Note from the Author or Editor:
Update incorrect name spelling from Tom Willke to Tom Wilkie

Luca Terzi  Nov 04, 2020 
Printed
Page 86
2nd paragraph

The following is incorrect "recently upgraded to 1.4.8 should signify" and needs to be updated to "recently upgraded to 1.5.7 should signify"

Lachlan Evenson
 
Jun 01, 2020  Jul 10, 2020
Printed
Page 115
Last bulleted list

cpu and memory in the list need to be updated to requests.cpu and requests.memory respectively. limits.memory is also missing and needs to be added with the following description:

limit.memory Sum of memory limits cannot exceed this amount.

Lachlan Evenson
 
Jun 01, 2020  Jul 10, 2020
Page 132 Figure 9-6
Yml section and Diagram

I would like to clarify 3 things

1) In the yml the author states properties such as "loadBalancerIP: 13.12.21.31" but this ip is not shown in the diagram 9-6. Is it meant to be the Ip address of the box which says "Cloud Provider Load Balancer"

2) In the yml the author states the target port is 8081 but in teh diagram it show port 80 is opened by each pod

3) In the yml the author states "loadBalancerSourceRanges: 142.43.0.0/16" this is not shhown in the diagram

Thanks


Note from the Author or Editor:
Thank you and sorry for the confusion. See responses to your questions below

1) Yes that's correct. We will have the diagram updated to reflect the Load Balancer IP

2) It's best practice to have non-root level ports opened in the pods, therefore the target port should remain the same (8081) and the Pod A,B,C port numbers should be updated to be 8081 in the diagram.

3) The external client should an IP from within the 142.43.0.0/16 for examples 142.43.0.100/16 as the loadBalancerSourceRanges field will restrict traffic to hosts within that network.

Deepak Dhayatker  Dec 02, 2020 
Printed
Page 214
2nd paragraph

The following "updating the application code to log out to a stdout or stderr sidecar container" needs updating to "updating the application code to log out to a stdout or stderr of a sidecar container'"

Lachlan Evenson
 
Jun 01, 2020  Jul 10, 2020
Printed
Page 215
second bullet

I guess in the chapter "Volume Best Practices" in the sentence
"Use hostDir when access to the data is required by node-based agents or services"
hostDir should be replaced by hostPath.

Note from the Author or Editor:
Replace hostDir with hostPath

Anonymous  Oct 15, 2020 
Printed
Page 234
1st YAML block

The following section in the YAML needs to be updated as follows:

```
resourceAttributes:
namespace: kube-system
```

Lachlan Evenson
 
Jun 01, 2020  Jul 10, 2020