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
|
||||
`Receive Adapater` watches for Kubernetes events and forwards them to the
|
||||
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
|
||||
kubectl apply -f serviceaccount.yaml
|
||||
|
|
|
@ -38,18 +38,18 @@ The following dashboards are pre-installed with Knative Serving:
|
|||
4. Set up an administrator account to modify or add dashboards by signing in
|
||||
with username: `admin` and password: `admin`.
|
||||
|
||||
- Before you expose the Grafana UI outside the cluster, make sure to change the
|
||||
- Before you expose the Grafana UI outside the cluster, make sure to change the
|
||||
password. You will be prompted to set a password on first login, and it can
|
||||
later be changed at
|
||||
[http://localhost:3000/org/users](http://localhost:3000/org/users).
|
||||
|
||||
|
||||
## Prometheus
|
||||
|
||||
Although Grafana provides a richer set of graphing functionality, Prometheus can
|
||||
still be useful for debugging.
|
||||
|
||||
1. To open Prometheus, enter the following command:
|
||||
|
||||
```shell
|
||||
kubectl port-forward -n knative-monitoring \
|
||||
$(kubectl get pods -n knative-monitoring \
|
||||
|
@ -57,7 +57,7 @@ $(kubectl get pods -n knative-monitoring \
|
|||
9090
|
||||
```
|
||||
|
||||
- This starts a local proxy of Prometheus on port 9090. For security reasons,
|
||||
- This starts a local proxy of Prometheus on port 9090. For security reasons,
|
||||
the Prometheus UI is exposed only within the cluster.
|
||||
|
||||
2. Navigate to the Prometheus UI at
|
||||
|
@ -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
|
||||
the page
|
||||
|
||||
|
||||
---
|
||||
|
||||
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
|
||||
external IP address of the `istio-ingressgateway` service to a static IP.
|
||||
|
||||
If you have configured a [custom ingress
|
||||
gateway](setting-up-custom-ingress-gateway.md), replace `istio-ingressgateway` with the name of your
|
||||
gateway service in the steps below.
|
||||
If you have configured a
|
||||
[custom ingress gateway](setting-up-custom-ingress-gateway.md), replace
|
||||
`istio-ingressgateway` with the name of your gateway service in the steps below.
|
||||
|
||||
## Step 1: Reserve a static IP address
|
||||
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
# Creating a RESTful Service
|
||||
|
||||
This sample demonstrates creating and running a simple RESTful service on Knative Serving.
|
||||
The exposed endpoint takes a stock ticker (i.e. stock symbol), then outputs the stock price.
|
||||
This sample demonstrates creating and running a simple RESTful service on
|
||||
Knative Serving. The exposed endpoint takes a stock ticker (i.e. stock symbol),
|
||||
then outputs the stock price.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. A Kubernetes cluster with
|
||||
[Knative Serving](https://github.com/knative/docs/blob/master/install/README.md) v0.3 or higher installed.
|
||||
1. [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment) 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.
|
||||
[Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
|
||||
v0.3 or higher installed.
|
||||
1. [Docker](https://docs.docker.com/get-started/#prepare-your-docker-environment)
|
||||
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.
|
||||
|
||||
```
|
||||
|
@ -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
|
||||
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
|
||||
[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).
|
||||
image can be accomplished locally using
|
||||
[Docker](https://docs.docker.com/get-started) or
|
||||
[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.
|
||||
|
||||
|
@ -34,8 +39,9 @@ To build and push to a container registry using Docker:
|
|||
cd $GOPATH/src/github.com/knative/docs
|
||||
```
|
||||
|
||||
2. Set your preferred container registry endpoint as an environment variable. This sample uses [Google Container
|
||||
Registry (GCR)](https://cloud.google.com/container-registry/):
|
||||
2. Set your preferred container registry endpoint as an environment variable.
|
||||
This sample uses
|
||||
[Google Container Registry (GCR)](https://cloud.google.com/container-registry/):
|
||||
|
||||
```
|
||||
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:
|
||||
|
||||
* Create a [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).
|
||||
* Setup an [auth
|
||||
helper](https://cloud.google.com/container-registry/docs/advanced-authentication#gcloud_as_a_docker_credential_helper)
|
||||
- Create a
|
||||
[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).
|
||||
- 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.
|
||||
|
||||
If you are using a different container registry, you will want to follow the
|
||||
registry specific instructions for both setup and authorizing the image
|
||||
push.
|
||||
registry specific instructions for both setup and authorizing the image push.
|
||||
|
||||
4. Use Docker to build your application container:
|
||||
|
||||
|
@ -87,7 +93,8 @@ docker push "${REPO}/serving/samples/rest-api-go"
|
|||
|
||||
## 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
|
||||
|
@ -100,11 +107,11 @@ the default namespace.
|
|||
|
||||
The Knative Service creates the following child resources:
|
||||
|
||||
* Knative Route
|
||||
* Knative Configuration
|
||||
* Knative Revision
|
||||
* Kubernetes Deployment
|
||||
* Kuberentes Service
|
||||
- Knative Route
|
||||
- Knative Configuration
|
||||
- Knative Revision
|
||||
- Kubernetes Deployment
|
||||
- Kuberentes Service
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
## Access the Service
|
||||
|
||||
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
|
||||
customized your gateway, you will want to adjust the enviornment variables below.
|
||||
This example assumes you are using the default Ingress Gateway setup for
|
||||
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:
|
||||
|
||||
|
@ -169,7 +176,8 @@ echo $INGRESS_IP
|
|||
|
||||
- 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
|
||||
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 \
|
||||
|
@ -218,8 +226,8 @@ Response body: `stock price for ticker <ticker> is <price>`
|
|||
|
||||
## Next Steps
|
||||
|
||||
The [traffic splitting
|
||||
example](https://github.com/knative/docs/tree/master/serving/samples/traffic-splitting)
|
||||
The
|
||||
[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
|
||||
between multiple Revisions.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Setting Up Custom Ingress Gateway
|
||||
|
||||
Knative uses a shared ingress Gateway to serve all incoming traffic within Knative
|
||||
service mesh, which is the `knative-ingress-gateway` Gateway under
|
||||
Knative uses a shared ingress Gateway to serve all incoming traffic within
|
||||
Knative service mesh, which is the `knative-ingress-gateway` Gateway under
|
||||
`knative-serving` namespace. By default, we use Istio gateway service
|
||||
`istio-ingressgateway` under `istio-system` namespace as its underlying service.
|
||||
You can replace the service with that of your own as follows.
|
||||
|
@ -33,37 +33,29 @@ spec:
|
|||
app: custom-ingressgateway
|
||||
custom: ingressgateway
|
||||
ports:
|
||||
-
|
||||
name: http2
|
||||
- name: http2
|
||||
nodePort: 32380
|
||||
port: 80
|
||||
targetPort: 80
|
||||
-
|
||||
name: https
|
||||
- name: https
|
||||
nodePort: 32390
|
||||
port: 443
|
||||
-
|
||||
name: tcp
|
||||
- name: tcp
|
||||
nodePort: 32400
|
||||
port: 31400
|
||||
-
|
||||
name: tcp-pilot-grpc-tls
|
||||
- name: tcp-pilot-grpc-tls
|
||||
port: 15011
|
||||
targetPort: 15011
|
||||
-
|
||||
name: tcp-citadel-grpc-tls
|
||||
- name: tcp-citadel-grpc-tls
|
||||
port: 8060
|
||||
targetPort: 8060
|
||||
-
|
||||
name: tcp-dns-tls
|
||||
- name: tcp-dns-tls
|
||||
port: 853
|
||||
targetPort: 853
|
||||
-
|
||||
name: http2-prometheus
|
||||
- name: http2-prometheus
|
||||
port: 15030
|
||||
targetPort: 15030
|
||||
-
|
||||
name: http2-grafana
|
||||
- name: http2-grafana
|
||||
port: 15031
|
||||
targetPort: 15031
|
||||
---
|
||||
|
@ -114,13 +106,13 @@ spec:
|
|||
- -v
|
||||
- "2"
|
||||
- --discoveryRefreshDelay
|
||||
- '1s' #discoveryRefreshDelay
|
||||
- "1s" #discoveryRefreshDelay
|
||||
- --drainDuration
|
||||
- '45s' #drainDuration
|
||||
- "45s" #drainDuration
|
||||
- --parentShutdownDuration
|
||||
- '1m0s' #parentShutdownDuration
|
||||
- "1m0s" #parentShutdownDuration
|
||||
- --connectTimeout
|
||||
- '10s' #connectTimeout
|
||||
- "10s" #connectTimeout
|
||||
- --serviceCluster
|
||||
- custom-ingressgateway
|
||||
- --zipkinAddress
|
||||
|
|
Loading…
Reference in New Issue