mirror of https://github.com/knative/docs.git
Format markdown (#913)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
This commit is contained in:
parent
fc28f9071c
commit
5cf66b78e7
|
@ -27,7 +27,8 @@ kubectl -n default apply -f channel.yaml
|
||||||
1. Create a Service Account that the `Receive Adapter` runs as. The
|
1. Create a Service Account that the `Receive Adapter` runs as. The
|
||||||
`Receive Adapater` watches for Kubernetes events and forwards them to the
|
`Receive Adapater` watches for Kubernetes events and forwards them to the
|
||||||
Knative Eventing Framework. If you want to re-use an existing Service Account
|
Knative Eventing Framework. If you want to re-use an existing Service Account
|
||||||
with the appropriate permissions, you need to modify the `serviceaccount.yaml`.
|
with the appropriate permissions, you need to modify the
|
||||||
|
`serviceaccount.yaml`.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f serviceaccount.yaml
|
kubectl apply -f serviceaccount.yaml
|
||||||
|
|
|
@ -43,13 +43,13 @@ The following dashboards are pre-installed with Knative Serving:
|
||||||
later be changed at
|
later be changed at
|
||||||
[http://localhost:3000/org/users](http://localhost:3000/org/users).
|
[http://localhost:3000/org/users](http://localhost:3000/org/users).
|
||||||
|
|
||||||
|
|
||||||
## Prometheus
|
## Prometheus
|
||||||
|
|
||||||
Although Grafana provides a richer set of graphing functionality, Prometheus can
|
Although Grafana provides a richer set of graphing functionality, Prometheus can
|
||||||
still be useful for debugging.
|
still be useful for debugging.
|
||||||
|
|
||||||
1. To open Prometheus, enter the following command:
|
1. To open Prometheus, enter the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl port-forward -n knative-monitoring \
|
kubectl port-forward -n knative-monitoring \
|
||||||
$(kubectl get pods -n knative-monitoring \
|
$(kubectl get pods -n knative-monitoring \
|
||||||
|
@ -74,7 +74,6 @@ discovery issues for metrics.
|
||||||
- To see a specific metric you can search for in the in search box on the top of
|
- To see a specific metric you can search for in the in search box on the top of
|
||||||
the page
|
the page
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Except as otherwise noted, the content of this page is licensed under the
|
Except as otherwise noted, the content of this page is licensed under the
|
||||||
|
|
|
@ -12,9 +12,9 @@ the "istio-ingressgateway" service under the `istio-system` namespace.
|
||||||
Therefore, in order to set a static IP for the gateway you must to set the
|
Therefore, in order to set a static IP for the gateway you must to set the
|
||||||
external IP address of the `istio-ingressgateway` service to a static IP.
|
external IP address of the `istio-ingressgateway` service to a static IP.
|
||||||
|
|
||||||
If you have configured a [custom ingress
|
If you have configured a
|
||||||
gateway](setting-up-custom-ingress-gateway.md), replace `istio-ingressgateway` with the name of your
|
[custom ingress gateway](setting-up-custom-ingress-gateway.md), replace
|
||||||
gateway service in the steps below.
|
`istio-ingressgateway` with the name of your gateway service in the steps below.
|
||||||
|
|
||||||
## Step 1: Reserve a static IP address
|
## Step 1: Reserve a static IP address
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
# Creating a RESTful Service
|
# Creating a RESTful Service
|
||||||
|
|
||||||
This sample demonstrates creating and running a simple RESTful service on Knative Serving.
|
This sample demonstrates creating and running a simple RESTful service on
|
||||||
The exposed endpoint takes a stock ticker (i.e. stock symbol), then outputs the stock price.
|
Knative Serving. The exposed endpoint takes a stock ticker (i.e. stock symbol),
|
||||||
|
then outputs the stock price.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
1. A Kubernetes cluster with
|
1. A Kubernetes cluster with
|
||||||
[Knative Serving](https://github.com/knative/docs/blob/master/install/README.md) v0.3 or higher installed.
|
[Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
|
||||||
1. [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment) installed locally.
|
v0.3 or higher installed.
|
||||||
1. [Outbound network access](https://github.com/knative/docs/blob/master/serving/outbound-network-access.md) enabled for
|
1. [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment)
|
||||||
this Service to amke external API requests.
|
installed locally.
|
||||||
|
1. [Outbound network access](https://github.com/knative/docs/blob/master/serving/outbound-network-access.md)
|
||||||
|
enabled for this Service to amke external API requests.
|
||||||
1. The code checked out locally.
|
1. The code checked out locally.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -20,9 +23,11 @@ go get -d github.com/knative/docs/serving/samples/rest-api-go
|
||||||
|
|
||||||
In order to run an application on Knative Serving a container image must be
|
In order to run an application on Knative Serving a container image must be
|
||||||
available to fetch from a container registry. Building and pushing a container
|
available to fetch from a container registry. Building and pushing a container
|
||||||
image can be accomplished locally using [Docker](https://docs.docker.com/get-started) or
|
image can be accomplished locally using
|
||||||
[ko](https://github.com/google/go-containerregistry/tree/master/cmd/ko) as well as
|
[Docker](https://docs.docker.com/get-started) or
|
||||||
remotely using [Knative Build](https://github.com/knative/docs/tree/master/build).
|
[ko](https://github.com/google/go-containerregistry/tree/master/cmd/ko) as well
|
||||||
|
as remotely using
|
||||||
|
[Knative Build](https://github.com/knative/docs/tree/master/build).
|
||||||
|
|
||||||
This sample uses Docker for both building and pushing.
|
This sample uses Docker for both building and pushing.
|
||||||
|
|
||||||
|
@ -34,8 +39,9 @@ To build and push to a container registry using Docker:
|
||||||
cd $GOPATH/src/github.com/knative/docs
|
cd $GOPATH/src/github.com/knative/docs
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Set your preferred container registry endpoint as an environment variable. This sample uses [Google Container
|
2. Set your preferred container registry endpoint as an environment variable.
|
||||||
Registry (GCR)](https://cloud.google.com/container-registry/):
|
This sample uses
|
||||||
|
[Google Container Registry (GCR)](https://cloud.google.com/container-registry/):
|
||||||
|
|
||||||
```
|
```
|
||||||
export REPO="gcr.io/<YOUR_PROJECT_ID>"
|
export REPO="gcr.io/<YOUR_PROJECT_ID>"
|
||||||
|
@ -45,16 +51,16 @@ export REPO="gcr.io/<YOUR_PROJECT_ID>"
|
||||||
|
|
||||||
To push to GCR, you need to:
|
To push to GCR, you need to:
|
||||||
|
|
||||||
* Create a [Google Cloud Platform
|
- Create a
|
||||||
project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project).
|
[Google Cloud Platform project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project).
|
||||||
* Enable the [Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
|
- Enable the
|
||||||
* Setup an [auth
|
[Google Container Registry API](https://console.cloud.google.com/apis/library/containerregistry.googleapis.com).
|
||||||
helper](https://cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper)
|
- Setup an
|
||||||
|
[auth helper](https://cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper)
|
||||||
to give the Docker client the permissions it needs to push.
|
to give the Docker client the permissions it needs to push.
|
||||||
|
|
||||||
If you are using a different container registry, you will want to follow the
|
If you are using a different container registry, you will want to follow the
|
||||||
registry specific instructions for both setup and authorizing the image
|
registry specific instructions for both setup and authorizing the image push.
|
||||||
push.
|
|
||||||
|
|
||||||
4. Use Docker to build your application container:
|
4. Use Docker to build your application container:
|
||||||
|
|
||||||
|
@ -87,7 +93,8 @@ docker push "${REPO}/serving/samples/rest-api-go"
|
||||||
|
|
||||||
## Deploy the Service
|
## Deploy the Service
|
||||||
|
|
||||||
Now that our image is available from the container registry, we can deploy the Knative Serving sample:
|
Now that our image is available from the container registry, we can deploy the
|
||||||
|
Knative Serving sample:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl apply --filename serving/samples/rest-api-go/sample.yaml
|
kubectl apply --filename serving/samples/rest-api-go/sample.yaml
|
||||||
|
@ -100,11 +107,11 @@ the default namespace.
|
||||||
|
|
||||||
The Knative Service creates the following child resources:
|
The Knative Service creates the following child resources:
|
||||||
|
|
||||||
* Knative Route
|
- Knative Route
|
||||||
* Knative Configuration
|
- Knative Configuration
|
||||||
* Knative Revision
|
- Knative Revision
|
||||||
* Kubernetes Deployment
|
- Kubernetes Deployment
|
||||||
* Kuberentes Service
|
- Kuberentes Service
|
||||||
|
|
||||||
You can inspect the created resources with the following `kubectl` commands:
|
You can inspect the created resources with the following `kubectl` commands:
|
||||||
|
|
||||||
|
@ -149,12 +156,12 @@ kubectl get deployment -l
|
||||||
"serving.knative.dev/service=stock-service-example" -o yaml
|
"serving.knative.dev/service=stock-service-example" -o yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Access the Service
|
## Access the Service
|
||||||
|
|
||||||
To access this service via `curl`, you need to determine its ingress address.
|
To access this service via `curl`, you need to determine its ingress address.
|
||||||
This example assumes you are using the default Ingress Gateway setup for Knative. If you
|
This example assumes you are using the default Ingress Gateway setup for
|
||||||
customized your gateway, you will want to adjust the enviornment variables below.
|
Knative. If you customized your gateway, you will want to adjust the enviornment
|
||||||
|
variables below.
|
||||||
|
|
||||||
1. To get the IP address of your Ingress Gateway:
|
1. To get the IP address of your Ingress Gateway:
|
||||||
|
|
||||||
|
@ -169,7 +176,8 @@ echo $INGRESS_IP
|
||||||
|
|
||||||
- If your cluster is running outside a cloud provider (for example on Minikube),
|
- If your cluster is running outside a cloud provider (for example on Minikube),
|
||||||
your services will never get an external IP address, and your INGRESS_IP will
|
your services will never get an external IP address, and your INGRESS_IP will
|
||||||
be empty. In that case, use the istio `hostIP` and `nodePort` as the ingress IP:
|
be empty. In that case, use the istio `hostIP` and `nodePort` as the ingress
|
||||||
|
IP:
|
||||||
|
|
||||||
```
|
```
|
||||||
export INGRESS_IP=$(kubectl get po --selector $INGRESSGATEWAY_LABEL=ingressgateway --namespace istio-system \
|
export INGRESS_IP=$(kubectl get po --selector $INGRESSGATEWAY_LABEL=ingressgateway --namespace istio-system \
|
||||||
|
@ -218,8 +226,8 @@ Response body: `stock price for ticker <ticker> is <price>`
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
The [traffic splitting
|
The
|
||||||
example](https://github.com/knative/docs/tree/master/serving/samples/traffic-splitting)
|
[traffic splitting example](https://github.com/knative/docs/tree/master/serving/samples/traffic-splitting)
|
||||||
continues from here to walk through creating new Revisions and splitting traffic
|
continues from here to walk through creating new Revisions and splitting traffic
|
||||||
between multiple Revisions.
|
between multiple Revisions.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Setting Up Custom Ingress Gateway
|
# Setting Up Custom Ingress Gateway
|
||||||
|
|
||||||
Knative uses a shared ingress Gateway to serve all incoming traffic within Knative
|
Knative uses a shared ingress Gateway to serve all incoming traffic within
|
||||||
service mesh, which is the `knative-ingress-gateway` Gateway under
|
Knative service mesh, which is the `knative-ingress-gateway` Gateway under
|
||||||
`knative-serving` namespace. By default, we use Istio gateway service
|
`knative-serving` namespace. By default, we use Istio gateway service
|
||||||
`istio-ingressgateway` under `istio-system` namespace as its underlying service.
|
`istio-ingressgateway` under `istio-system` namespace as its underlying service.
|
||||||
You can replace the service with that of your own as follows.
|
You can replace the service with that of your own as follows.
|
||||||
|
@ -33,37 +33,29 @@ spec:
|
||||||
app: custom-ingressgateway
|
app: custom-ingressgateway
|
||||||
custom: ingressgateway
|
custom: ingressgateway
|
||||||
ports:
|
ports:
|
||||||
-
|
- name: http2
|
||||||
name: http2
|
|
||||||
nodePort: 32380
|
nodePort: 32380
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
-
|
- name: https
|
||||||
name: https
|
|
||||||
nodePort: 32390
|
nodePort: 32390
|
||||||
port: 443
|
port: 443
|
||||||
-
|
- name: tcp
|
||||||
name: tcp
|
|
||||||
nodePort: 32400
|
nodePort: 32400
|
||||||
port: 31400
|
port: 31400
|
||||||
-
|
- name: tcp-pilot-grpc-tls
|
||||||
name: tcp-pilot-grpc-tls
|
|
||||||
port: 15011
|
port: 15011
|
||||||
targetPort: 15011
|
targetPort: 15011
|
||||||
-
|
- name: tcp-citadel-grpc-tls
|
||||||
name: tcp-citadel-grpc-tls
|
|
||||||
port: 8060
|
port: 8060
|
||||||
targetPort: 8060
|
targetPort: 8060
|
||||||
-
|
- name: tcp-dns-tls
|
||||||
name: tcp-dns-tls
|
|
||||||
port: 853
|
port: 853
|
||||||
targetPort: 853
|
targetPort: 853
|
||||||
-
|
- name: http2-prometheus
|
||||||
name: http2-prometheus
|
|
||||||
port: 15030
|
port: 15030
|
||||||
targetPort: 15030
|
targetPort: 15030
|
||||||
-
|
- name: http2-grafana
|
||||||
name: http2-grafana
|
|
||||||
port: 15031
|
port: 15031
|
||||||
targetPort: 15031
|
targetPort: 15031
|
||||||
---
|
---
|
||||||
|
@ -114,13 +106,13 @@ spec:
|
||||||
- -v
|
- -v
|
||||||
- "2"
|
- "2"
|
||||||
- --discoveryRefreshDelay
|
- --discoveryRefreshDelay
|
||||||
- '1s' #discoveryRefreshDelay
|
- "1s" #discoveryRefreshDelay
|
||||||
- --drainDuration
|
- --drainDuration
|
||||||
- '45s' #drainDuration
|
- "45s" #drainDuration
|
||||||
- --parentShutdownDuration
|
- --parentShutdownDuration
|
||||||
- '1m0s' #parentShutdownDuration
|
- "1m0s" #parentShutdownDuration
|
||||||
- --connectTimeout
|
- --connectTimeout
|
||||||
- '10s' #connectTimeout
|
- "10s" #connectTimeout
|
||||||
- --serviceCluster
|
- --serviceCluster
|
||||||
- custom-ingressgateway
|
- custom-ingressgateway
|
||||||
- --zipkinAddress
|
- --zipkinAddress
|
||||||
|
|
Loading…
Reference in New Issue