Skip to content

Commit 78097aa

Browse files
committed
Language and spelling fixes with Grammarly
1 parent e63b88e commit 78097aa

11 files changed

+236
-238
lines changed

accessing-your-application.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
Deploying a pod is not enough to make it accessible from outside the cluster.
1212

13-
In this exercise you will learn how to make temporary connections to a pod inside the cluster via
13+
In this exercise, you will learn how to make temporary connections to a pod inside the cluster via
1414
`kubectl port-forward`.
1515

1616
## Port-forward
1717

1818
The `kubectl port-forward` command allows you to forward one or more local ports to a pod. This can
19-
be used to access a pod that is running in the cluster, using for example a web browser or a
19+
be used to access a pod that is running in the cluster, using a web browser or a
2020
command line tool like `curl`.
2121

2222
The command takes two arguments: the pod name and the port to forward. The port is specified as
@@ -32,14 +32,14 @@ You can then access the pod on `localhost:8080`.
3232
<details>
3333
<summary>:bulb: How does this port-forward work?</summary>
3434

35-
Port forwarding is a network address translation that redirects internet packets form one IP address
36-
with specified port number to another `IP:PORT` set.
35+
Port forwarding is a network address translation that redirects Internet packets from one IP address
36+
to another with a specified port number to another `IP:PORT` set.
3737

38-
In Kubernetes `port-forward` creates a tunnel between your local machine and Kubernetes cluster on
39-
the specified `IP:PORT` pairs in order to establish connection to the cluster.
40-
`kubectl port-forward` allows you to forward not only pods but also services, deployments and other.
38+
In Kubernetes `port-forward` creates a tunnel between your local machine and the Kubernetes cluster on
39+
the specified `IP:PORT` pairs to establish a connection to the cluster.
40+
`kubectl port-forward` allows you to forward not only pods but also services, deployments, and others.
4141

42-
More information can be found from [port-forward-access-application-cluste](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
42+
More information can be found from [Use Port Forwarding to Access Applications in a Cluster](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
4343

4444
</details>
4545

@@ -58,7 +58,7 @@ More information can be found from [port-forward-access-application-cluste](http
5858

5959
> :bulb: If you get stuck somewhere along the way, you can check the solution in the done folder.
6060
61-
### Step by step instructions
61+
### Step-by-step instructions
6262

6363
<details>
6464
<summary>
@@ -78,7 +78,7 @@ The pod is defined in the `frontend-pod.yaml` file.
7878

7979
</details>
8080

81-
- Check that the pod is running with `kubectl get pods` command.
81+
- Check that the pod is running with the `kubectl get pods` command.
8282

8383
You should see something like this:
8484

@@ -89,30 +89,30 @@ frontend 1/1 Running 0 2m
8989

9090
- Expose the frontend with port-forward
9191

92-
Port forward can be achieved with:
92+
Port forwarding can be achieved with:
9393

9494
`kubectl port-forward --address 0.0.0.0 frontend 8080:5000`
9595

9696
> :bulb: We add the `--address 0.0.0.0` option to the port-forward command to make it accept
9797
> commands coming from remote machines, like your laptop! `0.0.0.0` Means any address, so you
98-
> probably don't want to do this on your own machine in, unless you want to expose something
98+
> probably don't want to do this on your machine unless you want to expose something
9999
> to the internet.
100100
101101
It can now be accessed on `http://workstation-<number>.<prefix>.eficode.academy:8080`
102102
(from the internet). Notice the plain, unencrypted `http` connection. It is not `https`, and your
103-
browser may complain about it. TLS is an advanced topic and out of scope for now.
103+
browser may complain about it. TLS is an advanced topic and is currently out of scope.
104104

105-
> :bulb: VSCode will ask you if you what to see the open port. Unfortunately vscode proxy does not
106-
> proxy requests correctly back to the pod, so use the URL of the instance instead.
105+
:bulb: VSCode will prompt you to view the open port. Unfortunately, vscode proxy does not
106+
> proxy requests correctly back to the pod, so use the URL of the workstation instance instead.
107107
108108
- Look at it in the browser.
109109

110110
Now we will deploy both the frontend and backend pods.
111111

112112
- Stop the port-forward process by pressing `Ctrl-c` in the terminal.
113-
- Delete the frontend pod with `kubectl delete pod frontend` command.
114-
- Deploy the backend pod with `kubectl apply -f backend-pod.yaml` command.
115-
- Check that the pod is running, and note down the IP with `kubectl get pods -o wide` command.
113+
- Delete the frontend pod with the `kubectl delete pod frontend` command.
114+
- Deploy the backend pod with the `kubectl apply -f backend-pod.yaml` command.
115+
- Check that the pod is running, and note down the IP with the `kubectl get pods -o wide` command.
116116

117117
You should see something like this:
118118

@@ -123,7 +123,7 @@ NAME READY STATUS RESTARTS AGE IP NODE
123123
backend 1/1 Running 0 11s 10.0.40.196 ip-10-0-35-102.eu-west-1.compute.internal <none> <none>
124124
```
125125

126-
In this case the IP is `10.0.40.196`, but it will be different in your case.
126+
In this case, the IP is `10.0.40.196`, but it will be different in your case.
127127

128128
#### Add environment variables to the frontend pod
129129

@@ -178,9 +178,9 @@ spec:
178178

179179
</details>
180180

181-
- Deploy the frontend pod with `kubectl apply -f frontend-pod.yaml` command.
181+
- Deploy the frontend pod with the `kubectl apply -f frontend-pod.yaml` command.
182182

183-
- Check that the pod is running with `kubectl get pods` command.
183+
- Check that the pod is running with the `kubectl get pods` command.
184184

185185
- Forward a local port to the pod using `kubectl port-forward`.
186186

@@ -190,9 +190,9 @@ You should see something like this:
190190

191191
![alt](img/app-front-back.png)
192192

193-
(if you don't you might need to refresh the page)
193+
(If you don't, you might need to refresh the page.)
194194

195-
- Exec into the frontend pod with `kubectl exec -it frontend -- /bin/sh` command.
195+
- Exec into the frontend pod with the command `kubectl exec -it frontend -- /bin/sh`.
196196

197197
- Execute a curl command to the backend `curl http://<BACKEND_IP>:5000`.
198198

@@ -205,10 +205,10 @@ Extra exercise
205205

206206
While still having the port-forward running
207207

208-
- Access the frontend in the browser and check that it still works and that frontend has access to
208+
- Access the frontend in the browser and check that it still works and that the frontend has access to
209209
the backend.
210-
- Try to delete the backend pod with `kubectl delete pod backend` command.
211-
- Try to recreate the backend pod with `kubectl apply -f backend-pod.yaml` command.
210+
- Try to delete the backend pod with the command `kubectl delete pod backend`.
211+
- Try to recreate the backend pod with the command `kubectl apply -f backend-pod.yaml`.
212212
- Access the frontend in the browser.
213213
- Does it still have access to the backend?
214214

@@ -218,10 +218,10 @@ If not, why not?
218218
<summary>Solution</summary>
219219

220220
The frontend pod is not configured to automatically re-resolve the backend IP address.
221-
So when we deleted the pod, and recreated it, the IP address changed, but the frontend pod still
221+
So when we deleted the pod and recreated it, the IP address changed, but the frontend pod still
222222
has the old IP address in its environment variables.
223223

224-
Thankfully Kubernetes has a networking abstraction called `services` which solves this exact (and
224+
Thankfully, Kubernetes has a networking abstraction called `services` which solves this exact (and
225225
more!) problem, which we will learn about in the next exercise.
226226

227227
</details>
@@ -230,9 +230,9 @@ more!) problem, which we will learn about in the next exercise.
230230

231231
### Clean up
232232

233-
- Stop the port-forward with `Ctrl+C` command.
234-
- Delete the pod with `kubectl delete pod frontend` command.
235-
- Delete the pod with `kubectl delete pod backend` command.
233+
- Stop the port-forward with the `Ctrl+C` command.
234+
- Delete the pod with the `kubectl delete pod frontend` command.
235+
- Delete the pod with the `kubectl delete pod backend` command.
236236

237237
Congratulations! You have now learned how to make temporary connections to a pod inside the cluster
238238
via `kubectl port-forward`, and how to use environment variables to configure the pod.

cheatsheet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ kubectl config set-context $(kubectl config current-context) --namespace=my-name
77
# Change default namespace
88

99
kubectl help run # See help about run (or other commands)
10-
kubectl explain pod.spec # Documenation on any resource attribute
10+
kubectl explain pod.spec # Documentation on any resource attribute
1111

1212
kubectl get nodes # See nodes in cluster
1313
kubectl get pods -o wide # See pods in current namespace
1414
kubectl get pod <name> -o yaml # See info about pod <name> in yaml format
1515
kubectl describe pod <name> # Show information about pod <name>
1616
kubectl describe service <name> # Show information about service <name>
1717

18-
kubectl api-resources # See resources types and abbreviations
18+
kubectl api-resources # See resource types and abbreviations
1919

2020
kubectl create namespace my-namespace # Create namespace
2121
# Set default namespace

configmaps-secrets.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
## Introduction
99

1010
Configmaps and secrets are a way to store information that is used by several deployments and pods
11-
in your cluster. This makes it easy to update the configuration in one place, when you want to
11+
in your cluster. This makes it easy to update the configuration in one place when you want to
1212
change it.
1313

1414
Both configmaps and secrets are generic `key-value` pairs, but secrets are `base64 encoded` and
1515
configmaps are not.
1616

17-
> :bulb: Secrets are not encrypted, they are encoded. This means that if someone gets access to the
17+
> :bulb: Secrets are not encrypted; they are encoded. This means that if someone gets access to the
1818
> cluster, they will be able to read the values.
1919
2020
## ConfigMaps
@@ -23,10 +23,10 @@ You use a ConfigMap to keep your application code separate from your configurati
2323

2424
It is an important part of creating a [Twelve-Factor Application](https://12factor.net/).
2525

26-
This lets you change easily configuration depending on the environment (development, production,
26+
This lets you change configuration easily depending on the environment (development, production,
2727
testing, etc.) and to dynamically change configuration at runtime.
2828

29-
A ConfigMap manifest looks like this in yaml:
29+
A ConfigMap manifest looks like this in YAML:
3030

3131
```yaml
3232
apiVersion: v1
@@ -101,7 +101,7 @@ data:
101101

102102
`secrets` are used for storing configuration that is considered sensitive, and well ... _secret_.
103103

104-
When you create a `secret` Kubernetes will go out of it's way to not print the actual values of
104+
When you create a `secret`, Kubernetes will go out of its way to not print the actual values of
105105
secret object, to things like logs or command output.
106106

107107
You should use `secrets` to store things like passwords for databases, API keys, certificates, etc.
@@ -113,19 +113,19 @@ source these values from environment variables.
113113
actual values are `base64` encoded. `base64` encoded means that the values are obscured, but can be
114114
trivially decoded. When values from a `secret` are used, Kubernetes handles the decoding for you.
115115

116-
> :bulb: As `secrets` don't actually make their data secret for anyone with access to the cluster,
116+
> :bulb: As `secrets` don't make their data secret for anyone with access to the cluster,
117117
> you should think of `secrets` as metadata for humans, to know that the data contained within is
118118
> considered secret.
119119

120120
## Using ConfigMaps and Secrets in a deployment
121121

122-
To use a configmap or secret in a deployment, you can either mount it in as a volume, or use it
122+
To use a configmap or secret in a deployment, you can either mount it as a volume or use it
123123
directly as an environment variable.
124124

125125
### Injecting a ConfigMap as environment variables
126126

127127
This will inject all key-value pairs from a configmap as environment variables in a container.
128-
The keys will be the name of variables, and the values will be values of the variables.
128+
The keys will be the names of variables, and the values will be the values of the variables.
129129

130130
```yaml
131131
apiVersion: apps/v1
@@ -151,10 +151,10 @@ spec:
151151

152152
- Add the database part of the application
153153
- Change the database user into a configmap and implement that in the backend
154-
- Change the database password into a secret, and implement that in the backend.
154+
- Change the database password to a secret, and implement that in the backend.
155155
- Change database deployment to use the configmap and secret.
156156

157-
### Step by step instructions
157+
### Step-by-step instructions
158158

159159
<details>
160160
<summary>
@@ -168,7 +168,7 @@ Step by step:
168168
We have already created the database part of the application, with a deployment and a service.
169169

170170
- Look at the database deployment file `postgres-deployment.yaml`.
171-
Notice the database username and password are injected as hardcoded environment variables.
171+
Notice that the database username and password are injected as hardcoded environment variables.
172172

173173
> :bulb: This is not a good practice, as we do not want to store these values in version control.
174174
> We will fix this in the next steps.
@@ -194,10 +194,10 @@ postgres-6fbd757dd7-ttpqj 1/1 Running 0 4s
194194
#### Refactor the database user into a configmap and implement that in the backend
195195

196196
We want to change the database user into a configmap, so that we can change it in one place, and
197-
use it on all deployments that needs it.
197+
use it on all deployments that need it.
198198

199199
- Create a configmap with the name `postgres-config` and filename `postgres-config.yaml` and the
200-
information about database configuration as follows:
200+
information about the database configuration as follows:
201201

202202
```yaml
203203
data:
@@ -238,7 +238,7 @@ data:
238238

239239
</details>
240240

241-
- apply the configmap with `kubectl apply -f postgres-config.yaml`
241+
- Apply the configmap with `kubectl apply -f postgres-config.yaml`
242242
- In the `backend-deployment.yaml`, change the environment variables to use the configmap instead
243243
of the hardcoded values.
244244

@@ -266,14 +266,14 @@ data:
266266
name: postgres-config
267267
```
268268

269-
- re-apply the backend deployment with `kubectl apply -f backend-deployment.yaml`
270-
- check that the website is still running.
269+
- Re-apply the backend deployment with `kubectl apply -f backend-deployment.yaml`
270+
- Check that the website is still running.
271271

272272
#### Change the database password into a secret, and implement that in the backend
273273

274-
We want to change the database password into a secret, so that we can change it in one place, and
275-
use it on all deployments that needs it.
276-
In order for this, we need to change the backend deployment to use the secret instead of the
274+
We want to change the database password to a secret, so that we can change it in one place, and
275+
use it on all deployments that need it.
276+
For this, we need to change the backend deployment to use the secret instead of the
277277
configmap for the password itself.
278278

279279
- create a secret with the name `postgres-secret` and the following data:
@@ -340,12 +340,12 @@ envFrom:
340340

341341
We are going to implement the configmap and secret in the database deployment as well.
342342

343-
The standard Postgres docker image can be configured by setting specific environment variables,
343+
The standard Postgres Docker image can be configured by setting specific environment variables,
344344
([you can see the documentation here](https://hub.docker.com/_/postgres)).
345-
By populating these specific values we can configure the credentials for root user and the name of
346-
the database to be created.
345+
By populating these specific values, we can configure the credentials for the root user and the name
346+
of the database to be created.
347347

348-
This means that we need to change the way we are injecting the environment variables, in order to
348+
This means that we need to change the way we are injecting the environment variables, to
349349
make sure the environment variables have the correct names.
350350

351351
- Open the `postgres-deployment.yaml` file, and change the way the environment variables are
@@ -371,8 +371,8 @@ env:
371371
key: DB_PASSWORD
372372
```
373373

374-
- re-apply the database deployment with `kubectl apply -f postgres-deployment.yaml`
375-
- check that the website is still running, and that the new database can be reached from the backend.
374+
- Re-apply the database deployment with `kubectl apply -f postgres-deployment.yaml`
375+
- Check that the website is still running, and that the new database can be reached from the backend.
376376

377377
Congratulations! You have now created a configmap and a secret, and used them in your application.
378378

0 commit comments

Comments
 (0)