You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial_kp.md
+40-34Lines changed: 40 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,15 @@ build an OCI image from source and allow kpack rebuild the OCI image with update
29
29
```
30
30
31
31
> Note: The `<REGISTRY-HOSTNAME>` must be the registry prefix for its corresponding registry
32
-
> - For [dockerhub](https://hub.docker.com/) this should be `https://index.docker.io/v1/`. `kp`also offers a simplified way to create a dockerhub secret with a `--dockerhub` flag.
33
-
> - For [GCR](https://cloud.google.com/container-registry/) this should be `gcr.io`. `kp` also offers a simplified way to create a GCR secret with a `--gcr` flag that gets a path to a json file containing the service account password.
32
+
> - For [dockerhub](https://hub.docker.com/) `kp` offers a simplified way to create a dockerhub secret with a `--dockerhub` flag. The registry in the secret should be `https://index.docker.io/v1/`.
33
+
> - For [GCR](https://cloud.google.com/container-registry/), `kp` also offers a simplified way to create a GCR secret with a `--gcr` flag that followed by a path to a json file containing the service account password. The registry in the secret should be `gcr.io`.
34
34
35
35
> Note: The `<REPOSITORY>` must be a location in the docker registry that can be written to with the credentials
36
36
> - For [dockerhub](https://hub.docker.com/) this should be `my-username/my-repo`.
37
37
> - For [GCR](https://cloud.google.com/container-registry/) this should be `gcr.io/my-project/my-repo`.
38
38
39
+
> Note: Learn more about kpack secrets with the [kpack secret documentation](secrets.md)
40
+
39
41
2. Create a cluster store
40
42
41
43
A store resource is a repository of [buildpacks](http://buildpacks.io/) packaged
@@ -63,57 +65,60 @@ build an OCI image from source and allow kpack rebuild the OCI image with update
63
65
kp clusterstack save base --build-image paketobuildpacks/build:base-cnb --run-image paketobuildpacks/run:base-cnb
64
66
```
65
67
66
-
4. Create a Builder
67
-
68
-
A Builder is the kpack configuration for a [builder image](https://buildpacks.io/docs/concepts/components/builder/)
69
-
that includes the stack and buildpacks needed to build an OCI image from your app source code.
70
-
71
-
The Builder configuration will write to the registry with the secret configured in step one and will reference the
72
-
stack and store created in step three and four. The builder order will determine the order in which buildpacks are
73
-
used in the builder.
74
-
75
-
```
76
-
kp builder save my-builder \
77
-
--tag <IMAGE-TAG> \
78
-
--stack base \
79
-
--store default \
80
-
--buildpack paketo-buildpacks/java \
81
-
-n default
82
-
```
83
-
84
-
- Replace `<IMAGE-TAG>` with a valid image tag that exists in the registry you configured with the `--registry` flag when creating a Secret in step #1. The tag should be something like: `your-name/builder` or `gcr.io/your-project/your-repo/builder`.
85
-
86
-
5. Create a secret with push credentials for the docker registry that you plan on publishing OCI images to with kpack.
68
+
4. Create a secret with push credentials for the docker registry that you plan on publishing OCI images to with kpack.
69
+
This secret needs to be located in the same namespace as the builder that you will create in the next step.
87
70
88
71
The easiest way to do that is with `kp secret create`
89
72
90
73
```bash
91
-
kp secret save tutorial-registry-credentials \
74
+
kp secret create tutorial-registry-credentials \
92
75
--registry <REGISTRY-HOSTNAME> \
93
76
--registry-user <REGISTRY-USER> \
94
77
-n default
95
78
```
96
79
97
80
> Note: The `<REGISTRY-HOSTNAME>` must be the registry prefix for its corresponding registry
98
-
> - For [dockerhub](https://hub.docker.com/) this should be `https://index.docker.io/v1/`. `kp`also offers a simplified way to create a dockerhub secret with a `--dockerhub` flag.
99
-
> - For [GCR](https://cloud.google.com/container-registry/) this should be `gcr.io`. `kp` also offers a simplified way to create a GCR secret with a `--gcr` flag that followed by a path to a json file containing the service account password.
81
+
> - For [dockerhub](https://hub.docker.com/) `kp` offers a simplified way to create a dockerhub secret with a `--dockerhub` flag. The registry in the secret should be `https://index.docker.io/v1/`.
82
+
> - For [GCR](https://cloud.google.com/container-registry/), `kp` also offers a simplified way to create a GCR secret with a `--gcr` flag that followed by a path to a json file containing the service account password. The registry in the secret should be `gcr.io`.
100
83
101
84
Your secret create should look something like this:
102
85
103
86
```bash
104
87
kp secret create tutorial-registry-credentials \
105
-
--registry https://index.docker.io/v1/ \
106
-
--registry-user my-dockerhub-username \
88
+
--registry my-registry.io \
89
+
--registry-user my-registry-username \
107
90
-n default
108
91
```
109
-
or
92
+
or
110
93
```bash
111
94
kp secret create tutorial-registry-credentials \
112
-
--gcr service_account_password.json
95
+
--gcr service_account_password.json \
96
+
-n default
113
97
```
114
98
115
99
> Note: Learn more about kpack secrets with the [kpack secret documentation](secrets.md)
116
100
101
+
5. Create a Builder
102
+
103
+
A Builder is the kpack configuration for a [builder image](https://buildpacks.io/docs/concepts/components/builder/)
104
+
that includes the stack and buildpacks needed to build an OCI image from your app source code.
105
+
106
+
The Builder configuration will write to the registry with the secret configured in step one and will reference the
107
+
stack and store created in step three and four. The builder order will determine the order in which buildpacks are
108
+
used in the builder.
109
+
110
+
```
111
+
kp builder save my-builder \
112
+
--tag <IMAGE-TAG> \
113
+
--stack base \
114
+
--store default \
115
+
--buildpack paketo-buildpacks/java \
116
+
-n default
117
+
```
118
+
119
+
- Replace `<IMAGE-TAG>` with a valid image tag that exists in the registry you configured with the `--registry` flag when creating a Secret in the previous step.
120
+
The tag should be something like: `your-name/builder` or `gcr.io/your-project/your-repo/builder`.
121
+
117
122
118
123
6. Create a kpack image resource
119
124
@@ -136,9 +141,9 @@ build an OCI image from source and allow kpack rebuild the OCI image with update
136
141
-n default
137
142
```
138
143
139
-
- Make sure to replace `<IMAGE-TAG>` with the tag in the registry of the secret you configured in step #5. Something like:
140
-
your-name/app or gcr.io/your-project/app
141
-
- If you are using your application source, replace `--git`&`--git-revision`.
144
+
- Make sure to replace `<IMAGE-TAG>` with the tag in the registry of the secret you configured in step #5. Something like:
145
+
your-name/app or gcr.io/your-project/app
146
+
- If you are using your application source, replace `--git`&`--git-revision`.
142
147
> Note: To use a private git repo follow the instructions in [secrets](secrets.md)
143
148
144
149
You can now check the status of the image resource.
@@ -179,7 +184,7 @@ build an OCI image from source and allow kpack rebuild the OCI image with update
179
184
kp build logs tutorial-image -n default
180
185
```
181
186
182
-
Once the image resource finishes building you can get the fully resolved built OCI image with `kubectl get`
187
+
Once the image resource finishes building you can get the fully resolved built OCI image with `kp image status`
183
188
184
189
```bash
185
190
kp image status tutorial-image -n default
@@ -285,3 +290,4 @@ build an OCI image from source and allow kpack rebuild the OCI image with update
285
290
286
291
The next time new buildpacks are added to the store, kpack will automatically rebuild the builder. If the updated
287
292
buildpacks were used by the tutorial image resource, kpack will automatically create a new build to rebuild your OCI image.
293
+
in the registry you configured with the `--registry` flag when creating a Secret in step #1. The tag should be something like: `your-name/builder` or `gcr.io/your-project/your-repo/builder`.
0 commit comments