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: README.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This container image can be deployed on a Kubernetes cluster. It runs a web app,
10
10
11
11

12
12
13
-
## Deploy
13
+
## Quick start
14
14
15
15
You can deploy `hello-kubernetes` to your Kubernetes cluster using [Helm 3](https://helm.sh/docs/intro/install/). The Helm chart installation and configuration options can be found in the [Deploy using Helm](docs/deploy-using-helm.md) guide.
16
16
@@ -22,46 +22,50 @@ cd deploy/helm
22
22
23
23
### Example 1: Default
24
24
25
-
Deploy the `hello-kubernetes` app into the `hello-kubernetes-default` namespace with the default "Hello world!" message. The app is exposed via a public Load Balancer on port 80 by default - note that this only works in cloud provider based Kubernetes offerings.
25
+
Deploy the `hello-kubernetes` app into the `hello-kubernetes` namespace with the default "Hello world!" message. The app is exposed via a public Load Balancer on port 80 by default - note that a LoadBalancer service typically only works in cloud provider based Kubernetes offerings.
kubectl get svc hello-kubernetes -n hello-kubernetes-default -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'
31
+
kubectl get svc hello-kubernetes-hello-world -n hello-kubernetes -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'
32
32
```
33
33
34
34
### Example 2: Custom message
35
35
36
-
Deploy the `hello-kubernetes` app into the `hello-kubernetes-custom` namespace with an "I just deployed this on Kubernetes!" message. The app is exposed via a public Load Balancer on port 80 by default - note that this only works in cloud provider based Kubernetes offerings.
36
+
Deploy the `hello-kubernetes` app into the `hello-kubernetes` namespace with an "I just deployed this on Kubernetes!" message. The app is exposed via a public Load Balancer on port 80 by default - note that a LoadBalancer service typically only works in cloud provider based Kubernetes offerings.
--set message="I just deployed this on Kubernetes!"
41
41
42
42
# get the LoadBalancer ip address.
43
-
kubectl get svc hello-kubernetes -n hello-kubernetes-custom -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'
43
+
kubectl get svc hello-kubernetes-custom-message -n hello-kubernetes -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'
44
44
```
45
45
46
46
### Example 3: Ingress
47
47
48
-
Deploy the `hello-kubernetes` app into the `hello-kubernetes-ingress` namespace. This example assumes that an ingress has been deployed into the cluster and that the ingress has a path of `/app/hello-kubernetes/` mapped to the `hello-kubernetes` service.
48
+
Deploy the `hello-kubernetes` app into the `hello-kubernetes` namespace. This example assumes that an ingress has been deployed and configured in the cluster, and that the ingress has a path of `/app/hello-kubernetes/` mapped to the `hello-kubernetes` service.
49
49
50
50
The `hello-kubernetes` app can be reached on the ip address of the ingress via the `/app/hello-kubernetes/` path.
If you'd like to explore the various Helm chart configuration options, then read the [Deploy with Helm](docs/deploy-using-helm.md) documentation. You can also discover more about the ingress configuration options in the [Deploy with ingress](docs/deploy-with-ingress.md) documentation
60
64
61
65
### Building your own images
62
66
63
67
If you'd like to build the `hello-kubernetes` container image yourself and reference from your own registry or DockerHub repository, then you can get more details on how to do this in the [Build and push container images](docs/build-and-push-container-images.md) documentation.
64
68
65
69
### Development environment
66
70
67
-
If you have [VS Code](https://code.visualstudio.com/) and the [Visual Studio Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed, the `.devcontainer` folder will be used to provide a container based development environment. You can read more about how to use this in the [Development environments](docs/development-environment.md) documentation.
71
+
If you have [VS Code](https://code.visualstudio.com/) and the [VS Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed, the `.devcontainer` folder will be used to provide a container based development environment. You can read more about how to use this in the [Development environments](docs/development-environment.md) documentation.
Copy file name to clipboardExpand all lines: docs/build-and-push-container-images.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ The `hello-kubernetes` container image can be built and pushed to your own regis
6
6
7
7
-[make](https://www.gnu.org/software/make/)
8
8
-[Docker cli](https://www.docker.com/)
9
-
-Docker registry
9
+
-Container registry
10
10
11
-
If you are using the [Visual Studio Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) based development environment, all of these prerequisites will be available in the terminal.
11
+
If you are using the [VS Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) based development environment, all of the prerequisites will be available in the terminal.
Copy file name to clipboardExpand all lines: docs/deploy-using-helm.md
+10-11Lines changed: 10 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,8 @@ The `hello-kubernetes` Helm chart can be used to deploy the `hello-kubernetes` a
9
9
## Prerequisites
10
10
11
11
-[Helm 3](https://v3.helm.sh/)
12
-
-[Kubernetes](https://kubernetes.io/) cluster
12
+
13
+
If you are using the [VS Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) based development environment, all of the prerequisites will be available in the terminal.
13
14
14
15
## Configuration and installation
15
16
@@ -18,14 +19,12 @@ The following table lists the configuration parameters of the hello-kubernetes c
18
19
| Parameter | Type | Default | Description |
19
20
| --------- | ---- | ------- | ----------- |
20
21
|`message`|`string`|`""`| A custom message to display instead of the default. |
21
-
|`ingress.enabled`|`bool`|`false`| Indicate whether an ingress is being used. |
22
+
|`ingress.configured`|`bool`|`false`| Indicates whether an ingress has been configured in the cluster. <br/>Note: this chart will not install or configure an ingress. You will need to install an ingress controller and add ingress record to the app namespace. |
23
+
|`ingress.rewritePath`|`bool`|`true`| Indicates whether pathPrefix is rewritten by the ingress. <br/> If this is set to `true` then the hello-kubernetes dynamic content and static assets will be served from `/`, otherwise, they will be served from `/$pathPrefix`. |
22
24
|`ingress.pathPrefix`|`string`|`""`| The path prefix configured in the ingress for the hello-kubernetes service.<br/> Must be provided when ingress is used. |
23
-
|`service.name`|`string`|`"hello-kubernetes"`| The name of the service configured for the hello-kubernetes pods. |
24
25
|`service.type`|`string`|`"LoadBalancer"`| The service type. |
25
26
|`service.port`|`int`|`80`| The port exposed by the service. |
26
-
|`serviceAccount.name`|`string`|`"hello-kubernetes"`| The service account bound to the pods. |
27
27
|`deployment.replicaCount`|`int`|`2`| The number of replicas for the hello-kubernetes deployment. |
28
-
|`deployment.name`|`string`|`hello-kubernetes`| The name of the deployment containing the hello-kubernetes pods. |
29
28
|`deployment.container.image.repository`|`string`|`paulbouwer/hello-kubernetes`| The container image to run in the hello-kubernetes pods. |
30
29
|`deployment.container.image.tag`|`string`|`""`| The container image tag. If not specified, the chart's appVersion is used. |
31
30
|`deployment.container.image.pullPolicy`|`string`|`"IfNotPresent"`| The pull policy for the container image. |
@@ -44,18 +43,18 @@ cd deploy/helm
44
43
```
45
44
46
45
To install `hello-kubernets` via the Helm chart, use the following to:
47
-
- create the hello-kubernetes-default namespace
48
-
- deploy the chart located in the ./hello-kubernetes folder
46
+
- create the hello-kubernetes namespace if it doesn't exist
47
+
- deploy the chart located in the ./hello-kubernetes folder into the hello-kubernetes namespace
You can override the values for the configuration parameter defined in the table above, either directly in the `hello-kubernetes/values.yaml` file, or via the `--set` switches.
--set message="I just deployed this on Kubernetes!"
60
59
```
61
60
@@ -70,7 +69,7 @@ cd deploy/helm
70
69
You can modify the `hello-kubernetes` app by providing new values for the configuration parameter defined in the table above, either directly in the `hello-kubernetes/values.yaml` file, or via the `--set` switches.
The `hello-kubernetes` Helm chart can be used to deploy and configure the `hello-kubernetes` application for use with an ingress controller.
4
+
5
+
> **Note:**
6
+
>
7
+
> The `hello-kubernetes` Helm chart does **not** deploy an [Ingress Controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/) and does **not** deploy the [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) definition.
8
+
>
9
+
> The chart aims to support deployment to as many platforms and providers as possible, so the choice of Ingress Controller and configuration of Ingress resource is left to the person deploying.
10
+
11
+
## Prerequisites
12
+
13
+
-[Helm 3](https://v3.helm.sh/)
14
+
15
+
If you are using the [VS Code Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) based development environment, all of the prerequisites will be available in the terminal.
16
+
17
+
## Install ingress controller
18
+
19
+
Install an [Ingress Controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/) that is available for your platform or provider. Here is an example that uses the [Nginx Ingress Controller](https://kubernetes.github.io/ingress-nginx/deploy/) on a cloud provider:
Install two `hello-kubernetes` instances that will be available via 2 different paths on the ingress.
34
+
35
+
The `hello-world` instance will display the default "Hello world!" message, and the `custom-message` instance will display a "This is my custom message!" message.
The `hello-kubernetes` Helm chart has a `ingress.rewritePath` configuration parameter that is `true` by default. When used together with the `ingress.configured=true` configuration parameter, there is an assumption that the ingress being used supports path rewrites. See the [Deploy using Helm](deploy-using-helm.md) guidance for more details.
51
+
52
+
So from our example, a request to `/hello-world` should be rewritten to `/` before being passed to the `hello-world` app instance.
53
+
54
+
Create a file named `hello-kubernetes-ingress.yaml` with the content below. This ingress definition will be serviced by the nginx ingress controller due to the `kubernetes.io/ingress.class: nginx` annotation. It will also leverage the path rewrite capabilities of nginx via the `nginx.ingress.kubernetes.io/rewrite-target: /$2` annotation.
55
+
56
+
```yaml
57
+
# hello-kubernetes-ingress.yaml
58
+
apiVersion: networking.k8s.io/v1beta1
59
+
kind: Ingress
60
+
metadata:
61
+
name: hello-kubernetes-ingress
62
+
annotations:
63
+
kubernetes.io/ingress.class: nginx
64
+
nginx.ingress.kubernetes.io/rewrite-target: /$2
65
+
spec:
66
+
rules:
67
+
- http:
68
+
paths:
69
+
- backend:
70
+
serviceName: hello-kubernetes-hello-world
71
+
servicePort: 80
72
+
path: /hello-world(/|$)(.*)
73
+
- backend:
74
+
serviceName: hello-kubernetes-custom-message
75
+
servicePort: 80
76
+
path: /custom-message(/|$)(.*)
77
+
```
78
+
79
+
Deploy the contents of the `hello-kubernetes-ingress.yaml` into the same namespace as the two `hello-kubernetes` apps.
You can browse to each of the `hello-kubernetes` apps via the $INGRESS_CONTROLLER_IPADDRESS and each of the configured paths. So for our example at:
88
+
89
+
- `$INGRESS_CONTROLLER_IPADDRESS/hello-world`- the `hello-world` instance with the default "Hello world!" message
90
+
- `$INGRESS_CONTROLLER_IPADDRESS/custom-message`- the `custom-message` instance with the "This is my custom message!" message
91
+
92
+
## Alternatives
93
+
94
+
You can deploy the `hello-kubernetes` app via the Helm chart with the `ingress.rewritePath=false` configuration parameter if you are deploying with an ingress controller that does not support path rewrites.
95
+
96
+
In this case, the `hello-kubernetes` apps will serve dynamic content and static assets from the path defined by the `ingress.pathPrefix` configuration parameter.
0 commit comments