mirror of https://github.com/knative/docs.git
Fix markdown (#1395)
* Fix markdown * Fix all indentations in numbered lists * add additional "space" indentation for #1202
This commit is contained in:
parent
eaa9bbf59b
commit
65adb947ae
|
@ -6,11 +6,9 @@ Follow the steps below to create the sample code and then deploy the app to your
|
||||||
cluster. You can also download a working copy of the sample, by running the
|
cluster. You can also download a working copy of the sample, by running the
|
||||||
following commands:
|
following commands:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
||||||
git clone -b "release-0.6" https://github.com/knative/docs knative-docs cd
|
git clone -b "release-0.6" https://github.com/knative/docs knative-docs cd
|
||||||
knative-docs/serving/samples/hello-world/helloworld-java-spring
|
knative-docs/serving/samples/hello-world/helloworld-java-spring
|
||||||
|
|
||||||
````
|
````
|
||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
@ -26,7 +24,7 @@ and a Docker Hub account configured (we'll use it for a container registry).
|
||||||
## Recreating the sample code
|
## Recreating the sample code
|
||||||
|
|
||||||
1. From the console, create a new empty web project using the curl and unzip
|
1. From the console, create a new empty web project using the curl and unzip
|
||||||
commands:
|
commands:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl https://start.spring.io/starter.zip \
|
curl https://start.spring.io/starter.zip \
|
||||||
|
@ -37,15 +35,15 @@ commands:
|
||||||
unzip helloworld.zip
|
unzip helloworld.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't have curl installed, you can accomplish the same by visiting the
|
If you don't have curl installed, you can accomplish the same by visiting the
|
||||||
[Spring Initializr](https://start.spring.io/) page. Specify Artifact as
|
[Spring Initializr](https://start.spring.io/) page. Specify Artifact as
|
||||||
`helloworld` and add the `Web` dependency. Then click `Generate Project`,
|
`helloworld` and add the `Web` dependency. Then click `Generate Project`,
|
||||||
download and unzip the sample archive.
|
download and unzip the sample archive.
|
||||||
|
|
||||||
1. Update the `SpringBootApplication` class in
|
1. Update the `SpringBootApplication` class in
|
||||||
`src/main/java/com/example/helloworld/HelloworldApplication.java` by adding a
|
`src/main/java/com/example/helloworld/HelloworldApplication.java` by adding a
|
||||||
`@RestController` to handle the "/" mapping and also add a `@Value` field to
|
`@RestController` to handle the "/" mapping and also add a `@Value` field to
|
||||||
provide the TARGET environment variable:
|
provide the TARGET environment variable:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
package com.example.helloworld;
|
package com.example.helloworld;
|
||||||
|
@ -85,11 +83,11 @@ provide the TARGET environment variable:
|
||||||
Go to `http://localhost:8080/` to see your `Hello World!` message.
|
Go to `http://localhost:8080/` to see your `Hello World!` message.
|
||||||
|
|
||||||
1. In your project directory, create a file named `Dockerfile` and copy the code
|
1. In your project directory, create a file named `Dockerfile` and copy the code
|
||||||
block below into it. For detailed instructions on dockerizing a Spring Boot
|
block below into it. For detailed instructions on dockerizing a Spring Boot
|
||||||
app, see
|
app, see
|
||||||
[Spring Boot with Docker](https://spring.io/guides/gs/spring-boot-docker/).
|
[Spring Boot with Docker](https://spring.io/guides/gs/spring-boot-docker/).
|
||||||
For additional information on multi-stage docker builds for Java see
|
For additional information on multi-stage docker builds for Java see
|
||||||
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).
|
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).
|
||||||
|
|
||||||
```docker
|
```docker
|
||||||
# Use the official maven/Java 8 image to create a build artifact.
|
# Use the official maven/Java 8 image to create a build artifact.
|
||||||
|
@ -118,8 +116,8 @@ For additional information on multi-stage docker builds for Java see
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Create a new file, `service.yaml` and copy the following service definition
|
1. Create a new file, `service.yaml` and copy the following service definition
|
||||||
into the file. Make sure to replace `{username}` with your Docker Hub
|
into the file. Make sure to replace `{username}` with your Docker Hub
|
||||||
username.
|
username.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: serving.knative.dev/v1alpha1
|
apiVersion: serving.knative.dev/v1alpha1
|
||||||
|
@ -143,8 +141,8 @@ Once you have recreated the sample code files (or used the files in the sample
|
||||||
folder) you're ready to build and deploy the sample app.
|
folder) you're ready to build and deploy the sample app.
|
||||||
|
|
||||||
1. Use Docker to build the sample code into a container. To build and push with
|
1. Use Docker to build the sample code into a container. To build and push with
|
||||||
Docker Hub, run these commands replacing `{username}` with your Docker Hub
|
Docker Hub, run these commands replacing `{username}` with your Docker Hub
|
||||||
username:
|
username:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Build the container on your local machine
|
# Build the container on your local machine
|
||||||
|
@ -155,9 +153,9 @@ username:
|
||||||
```
|
```
|
||||||
|
|
||||||
1. After the build has completed and the container is pushed to docker hub, you
|
1. After the build has completed and the container is pushed to docker hub, you
|
||||||
can deploy the app into your cluster. Ensure that the container image value
|
can deploy the app into your cluster. Ensure that the container image value
|
||||||
in `service.yaml` matches the container you built in the previous step. Apply
|
in `service.yaml` matches the container you built in the previous step. Apply
|
||||||
the configuration using `kubectl`:
|
the configuration using `kubectl`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply --filename service.yaml
|
kubectl apply --filename service.yaml
|
||||||
|
@ -165,13 +163,13 @@ the configuration using `kubectl`:
|
||||||
|
|
||||||
1. Now that your service is created, Knative will perform the following steps:
|
1. Now that your service is created, Knative will perform the following steps:
|
||||||
|
|
||||||
- Create a new immutable revision for this version of the app.
|
- Create a new immutable revision for this version of the app.
|
||||||
- Network programming to create a route, ingress, service, and load balancer
|
- Network programming to create a route, ingress, service, and load balancer
|
||||||
for your app.
|
for your app.
|
||||||
- Automatically scale your pods up and down (including to zero active pods).
|
- Automatically scale your pods up and down (including to zero active pods).
|
||||||
|
|
||||||
1. To find the IP address for your service, use. If your cluster is new, it may
|
1. To find the IP address for your service, use. If your cluster is new, it may
|
||||||
take sometime for the service to get asssigned an external IP address.
|
take sometime for the service to get asssigned an external IP address.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
|
||||||
|
@ -193,6 +191,7 @@ take sometime for the service to get asssigned an external IP address.
|
||||||
export IP_ADDRESS=<EXTERNAL-IP column from the command above>
|
export IP_ADDRESS=<EXTERNAL-IP column from the command above>
|
||||||
|
|
||||||
# Or just execute:
|
# Or just execute:
|
||||||
|
|
||||||
export IP_ADDRESS=$(kubectl get svc $INGRESSGATEWAY \
|
export IP_ADDRESS=$(kubectl get svc $INGRESSGATEWAY \
|
||||||
--namespace istio-system \
|
--namespace istio-system \
|
||||||
--output jsonpath="{.status.loadBalancer.ingress[*].ip}")
|
--output jsonpath="{.status.loadBalancer.ingress[*].ip}")
|
||||||
|
@ -213,7 +212,7 @@ take sometime for the service to get asssigned an external IP address.
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Now you can make a request to your app to see the result. Presuming, the IP
|
1. Now you can make a request to your app to see the result. Presuming, the IP
|
||||||
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
address you got in the step above is in the `${IP_ADDRESS}` env variable:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}
|
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}
|
||||||
|
|
Loading…
Reference in New Issue