Skip to content

Commit 1dc583f

Browse files
Merge pull request #4417 from nokia/proofreading-chapter-1
Proofreading of chapter 1.
2 parents aaad95b + 7db9d3a commit 1dc583f

1 file changed

Lines changed: 55 additions & 64 deletions

File tree

  • documentation/content/en/book/01-getting-started
Lines changed: 55 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
11
---
22
title: "Chapter 1: Getting started"
33
linkTitle: "Chapter 1: Getting started"
4-
description: This chapter is a quick introduction to kpt using an example to demonstrate important concepts and
5-
features. The following chapters will cover these concepts in detail.
4+
description: This chapter provides a quick introduction to kpt, using examples to demonstrate the important concepts and features. The following chapters cover these concepts in detail.
65
toc: true
76
menu:
87
main:
98
parent: "Book"
109
weight: 10
1110
---
1211

13-
## System Requirements
12+
## System requirements
1413

1514
### kpt
1615

17-
Install the [kpt CLI](installation/kpt-cli):
16+
Install the [kpt CLI](installation/kpt-cli), using the following command:
1817

1918
```shell
2019
kpt version
2120
```
2221

2322
### Git
2423

25-
kpt requires that you have [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed and
24+
`kpt` requires that you have [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) installed and
2625
configured.
2726

28-
### Container Runtime
27+
### Container runtime
2928

30-
`kpt` requires you to have at least one of the following runtimes installed and configured.
29+
`kpt` requires that you have at least one of the following runtimes installed and configured.
3130

3231
#### Docker
3332

34-
Please follow the [instructions](https://docs.docker.com/get-docker) to install and configure Docker.
33+
Follow the [instructions](https://docs.docker.com/get-docker) to install and configure Docker.
3534

3635
#### Podman
3736

38-
Please follow the [instructions](https://podman.io/getting-started/installation) to install and configure Podman.
37+
Follow the [instructions](https://podman.io/getting-started/installation) to install and configure Podman.
3938

40-
If you want to set up rootless container runtime, [this](https://rootlesscontaine.rs/) may be a useful resource for you.
39+
If you want to set up a rootless container runtime, then [this](https://rootlesscontaine.rs/) may be a useful resource for you.
4140

4241
Environment variables can be used to control which container runtime to use. More details can be found in the reference
4342
documents for [`kpt fn render`](../../reference/cli/fn/render/) and [`kpt fn eval`](../../reference/cli/fn/eval/).
4443

4544
### Kubernetes cluster
4645

47-
In order to deploy the examples, you need a Kubernetes cluster and a configured kubeconfig context.
46+
To deploy the examples, you need a Kubernetes cluster and a configured kubectl context.
4847

49-
For testing purposes, [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) tool is useful for running ephemeral
50-
Kubernetes cluster on your local host.
48+
For testing purposes, the [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) tool is useful for running an ephemeral Kubernetes
49+
cluster on your local host.
5150

5251
## Quickstart
5352

5453
In this example, you are going to configure and deploy Nginx to a Kubernetes cluster.
5554

56-
### Fetch the package
55+
### Fetching the package
5756

58-
kpt is fully integrated with Git and enables forking, rebasing and versioning a package of configuration using the
57+
`kpt` is fully integrated with Git and enables the forking, rebasing, and versioning of a configuration package using the
5958
underlying Git version control system.
6059

61-
First, let's fetch the _kpt package_ from Git to your local filesystem:
60+
First, using the following command, fetch the kpt package from Git to your local filesystem:
6261

6362
```shell
6463
kpt pkg get https://github.com/kptdev/kpt/package-examples/nginx@v1.0.0-beta.61
@@ -70,9 +69,9 @@ Subsequent commands are run from the `nginx` directory:
7069
cd nginx
7170
```
7271

73-
`kpt pkg` commands provide the functionality for working with packages on Git and on your local filesystem.
72+
The `kpt pkg` commands provide the functionality for working with packages on Git and on your local filesystem.
7473

75-
Next, let's quickly view the content of the package:
74+
Next, use the following command to view the content of the package:
7675

7776
```shell
7877
kpt pkg tree
@@ -82,63 +81,61 @@ Package "nginx"
8281
└── [svc.yaml] Service my-nginx-svc
8382
```
8483

85-
As you can see, this package contains 3 resources in 3 files. There is a special file named `Kptfile` which is used by
84+
As can be seen, this package contains three resources in three files. There is a special file named `Kptfile`. This file is used by
8685
the kpt tool itself and is not deployed to the cluster. Later chapters will explain the `Kptfile` in detail.
8786

88-
Initialize a local Git repo and commit the forked copy of the package:
87+
Initialize a local Git repo and commit the forked copy of the package, using the following commands:
8988

9089
```shell
9190
git init; git add .; git commit -m "Pristine nginx package"
9291
```
9392

94-
### Customize the package
93+
### Customizing the package
9594

96-
At this point, you typically want to customize the package. With kpt, you can use different approaches depending on your
97-
use case.
95+
At this point, it is a good idea to customize the package. With kpt, you can use different approaches, depending on your use case.
9896

99-
#### Manual Editing
97+
#### Manual editing
10098

101-
You may want to manually edit the files. For example, modify the value of `spec.replicas` in `deployment.yaml` using
102-
your favorite editor:
99+
You may want to edit the files manually. For example, modify the value of `spec.replicas` in the `deployment.yaml` using your favorite
100+
editor:
103101

104102
```shell
105103
vim deployment.yaml
106104
```
107105

108-
#### Automating One-time Edits with Functions
106+
#### Automating one-time edits with functions
109107

110-
The [`kpt fn`](../../reference/cli/fn/) set of commands enable you to execute programs called _kpt functions_. These
111-
programs are packaged as containers and take in YAML files, mutate or validate them, and then output YAML.
108+
The [`kpt fn`](../../reference/cli/fn/) set of commands enables you to execute programs called _kpt functions_. These programs are
109+
packaged as containers and take YAML files as input, mutate or validate them, and then output YAML.
112110

113-
For instance, you can use a function (`ghcr.io/kptdev/krm-functions-catalog/search-replace:latest`) to search and replace all the occurrences of
114-
the `app` key in the `spec` section of the YAML document (`spec.**.app`) and set the value to `my-nginx`.
111+
For example, you can use a function (`ghcr.io/kptdev/krm-functions-catalog/search-replace:latest`) to search for and replace all the occurrences of the `app` key, in the `spec` section of the YAML document (`spec.**.app`), and set the value to `my-nginx`.
115112

116113
You can use the `kpt fn eval` command to run this mutation on your local files a single time:
117114

118115
```shell
119116
kpt fn eval --image ghcr.io/kptdev/krm-functions-catalog/search-replace:latest -- by-path='spec.**.app' put-value=my-nginx
120117
```
121118

122-
To see what changes were made to the local package:
119+
To see what changes were made to the local package, use the following command:
123120

124121
```shell
125122
git diff
126123
```
127124

128-
#### Declaratively Defining Edits
125+
#### Declaratively defining edits
129126

130-
For operations that need to be performed repeatedly, there is a _declarative_ way to define a pipeline of functions as
131-
part of the package (in the `Kptfile`). In this `nginx` package, the author has already declared a function (`kubeconform`)
132-
that validates the resources using their OpenAPI schema.
127+
For operations that need to be performed repeatedly, there is a _declarative_ way to define a pipeline of functions as part of the
128+
package (in the `Kptfile`). In this `nginx` package, the author has already declared a function (`kubeconform`) that validates the
129+
resources using their OpenAPI schema.
133130

134131
```yaml
135132
pipeline:
136133
validators:
137134
- image: ghcr.io/kptdev/krm-functions-catalog/kubeconform:latest
138135
```
139136
140-
You might want to label all resources in the package. To achieve that, you can declare `set-labels` function in the
141-
`pipeline` section of `Kptfile`. Add this by running the following command:
137+
It might be a good idea to label all the resources in the package. To achieve this, you can declare the `set-labels` function, in the
138+
`pipeline` section of the `Kptfile`. Add this by running the following command:
142139

143140
```shell
144141
cat >> Kptfile <<EOF
@@ -149,75 +146,69 @@ cat >> Kptfile <<EOF
149146
EOF
150147
```
151148

152-
This function will ensure that the label `env: dev` is added to all the resources in the package.
149+
This function ensures that the `env: dev` label is added to all the resources in the package.
153150

154-
The pipeline is executed using the `render` command:
151+
The pipeline is executed using the `render` command, as follows:
155152

156153
```shell
157154
kpt fn render
158155
```
159156

160-
Regardless of how you choose to customize the package — whether by manually editing it or running one-time functions
161-
using `kpt fn eval` — you need to _render_ the package before applying it the cluster. This ensures all the functions
162-
declared in the package are executed, and the package is ready to be applied to the cluster.
157+
Regardless of how you choose to customize the package, whether by manually editing it or running one-time functions using `kpt fn eval`, you need to _render_ the package before applying it to the cluster. This ensures that all the functions declared in the package have been executed, and the package is ready to be applied to the cluster.
163158

164-
### Apply the Package
159+
### Applying the package
165160

166-
`kpt live` commands provide the functionality for deploying packages to a Kubernetes cluster.
161+
The `kpt live` commands provide the functionality for deploying the packages to a Kubernetes cluster.
167162

168-
First, initialize the kpt package:
163+
First, initialize the kpt package, using the following command:
169164

170165
```shell
171166
kpt live init
172167
```
173168

174-
This adds metadata to the `Kptfile` required to keep track of changes made
175-
to the state of the cluster. This
176-
allows kpt to group resources so that they can be applied, updated, pruned, and
177-
deleted together.
169+
This adds to the `Kptfile` the metadata required to keep track of the changes made to the state of the cluster. This allows kpt to
170+
group the resources, so that they can be applied, updated, pruned, and deleted together.
178171

179172
Apply the resources to the cluster:
180173

181174
```shell
182175
kpt live apply --reconcile-timeout=15m
183176
```
184177

185-
This waits for the resources to be reconciled on the cluster by monitoring their
186-
status.
178+
This waits for the resources to be reconciled on the cluster by monitoring their status.
187179

188-
### Update the package
180+
### Updating the package
189181

190-
At some point, there will be a new version of the upstream `nginx` package, and
191-
you want to merge the upstream changes with changes to your local package.
182+
At some point, there will be a new version of the upstream `nginx` package, and you will need to merge the upstream changes with the
183+
changes to your local package.
192184

193-
First, commit your local changes:
185+
First, commit your local changes, using the following command:
194186

195187
```shell
196188
git add .; git commit -m "My customizations"
197189
```
198190

199-
Then update to version `latest`:
191+
Update to version `latest`:
200192

201193
```shell
202194
kpt pkg update @latest
203195
```
204196

205-
This merges the upstream changes with your local changes using a schema-aware
206-
merge strategy.
197+
This merges the upstream changes with your local changes, using a schema-aware merge strategy.
207198

208-
Apply the updated resources to the cluster:
199+
Apply the updated resources to the cluster, as follows:
209200

210201
```shell
211202
kpt live apply --reconcile-timeout=15m
212203
```
213204

214-
### Clean up
205+
### Cleaning up
215206

216-
Delete the package from the cluster:
207+
Delete the package from the cluster, using the following command:
217208

218209
```shell
219210
kpt live destroy
220211
```
221212

222-
Congrats! You should now have a rough idea of what kpt is and what you can do
223-
with it. Now, let's delve into the details.
213+
You should now have a rough idea of what kpt is and what you can do
214+
with it. Let us now delve into the details.

0 commit comments

Comments
 (0)