From 5cf66b78e745a96e9d95f0372fd5c8e163186ca0 Mon Sep 17 00:00:00 2001 From: mattmoor-sockpuppet Date: Tue, 19 Feb 2019 06:50:47 -0800 Subject: [PATCH] Format markdown (#913) Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)` --- .../samples/kubernetes-event-source/README.md | 3 +- serving/accessing-metrics.md | 9 +- serving/gke-assigning-static-ip-address.md | 6 +- serving/samples/rest-api-go/README.md | 68 +++--- serving/setting-up-custom-ingress-gateway.md | 212 +++++++++--------- 5 files changed, 149 insertions(+), 149 deletions(-) diff --git a/eventing/samples/kubernetes-event-source/README.md b/eventing/samples/kubernetes-event-source/README.md index 02aac2410..d74d150ff 100644 --- a/eventing/samples/kubernetes-event-source/README.md +++ b/eventing/samples/kubernetes-event-source/README.md @@ -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 diff --git a/serving/accessing-metrics.md b/serving/accessing-metrics.md index 5e9c9b25c..722a9e2d1 100644 --- a/serving/accessing-metrics.md +++ b/serving/accessing-metrics.md @@ -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,8 +57,8 @@ $(kubectl get pods -n knative-monitoring \ 9090 ``` - - This starts a local proxy of Prometheus on port 9090. For security reasons, - the Prometheus UI is exposed only within the cluster. +- 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 [http://localhost:9090](http://localhost:9090) @@ -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 diff --git a/serving/gke-assigning-static-ip-address.md b/serving/gke-assigning-static-ip-address.md index a616248b7..31cea3955 100644 --- a/serving/gke-assigning-static-ip-address.md +++ b/serving/gke-assigning-static-ip-address.md @@ -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 diff --git a/serving/samples/rest-api-go/README.md b/serving/samples/rest-api-go/README.md index 47b7006cc..c78d7ef66 100644 --- a/serving/samples/rest-api-go/README.md +++ b/serving/samples/rest-api-go/README.md @@ -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/" @@ -45,16 +51,16 @@ export REPO="gcr.io/" 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 is ` ## 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. diff --git a/serving/setting-up-custom-ingress-gateway.md b/serving/setting-up-custom-ingress-gateway.md index ab98fd6c4..6d9a311c5 100644 --- a/serving/setting-up-custom-ingress-gateway.md +++ b/serving/setting-up-custom-ingress-gateway.md @@ -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 --- @@ -109,109 +101,109 @@ spec: - containerPort: 15030 - containerPort: 15031 args: - - proxy - - router - - -v - - "2" - - --discoveryRefreshDelay - - '1s' #discoveryRefreshDelay - - --drainDuration - - '45s' #drainDuration - - --parentShutdownDuration - - '1m0s' #parentShutdownDuration - - --connectTimeout - - '10s' #connectTimeout - - --serviceCluster - - custom-ingressgateway - - --zipkinAddress - - zipkin:9411 - - --statsdUdpAddress - - istio-statsd-prom-bridge:9125 - - --proxyAdminPort - - "15000" - - --controlPlaneAuthPolicy - - NONE - - --discoveryAddress - - istio-pilot:8080 + - proxy + - router + - -v + - "2" + - --discoveryRefreshDelay + - "1s" #discoveryRefreshDelay + - --drainDuration + - "45s" #drainDuration + - --parentShutdownDuration + - "1m0s" #parentShutdownDuration + - --connectTimeout + - "10s" #connectTimeout + - --serviceCluster + - custom-ingressgateway + - --zipkinAddress + - zipkin:9411 + - --statsdUdpAddress + - istio-statsd-prom-bridge:9125 + - --proxyAdminPort + - "15000" + - --controlPlaneAuthPolicy + - NONE + - --discoveryAddress + - istio-pilot:8080 resources: requests: cpu: 10m env: - - name: POD_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: POD_NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - - name: INSTANCE_IP - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: status.podIP - - name: ISTIO_META_POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: INSTANCE_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: ISTIO_META_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name volumeMounts: - - name: istio-certs - mountPath: /etc/certs - readOnly: true - - name: ingressgateway-certs - mountPath: "/etc/istio/ingressgateway-certs" - readOnly: true - - name: ingressgateway-ca-certs - mountPath: "/etc/istio/ingressgateway-ca-certs" - readOnly: true + - name: istio-certs + mountPath: /etc/certs + readOnly: true + - name: ingressgateway-certs + mountPath: "/etc/istio/ingressgateway-certs" + readOnly: true + - name: ingressgateway-ca-certs + mountPath: "/etc/istio/ingressgateway-ca-certs" + readOnly: true volumes: - - name: istio-certs - secret: - secretName: istio.istio-ingressgateway-service-account - optional: true - - name: ingressgateway-certs - secret: - secretName: "istio-ingressgateway-certs" - optional: true - - name: ingressgateway-ca-certs - secret: - secretName: "istio-ingressgateway-ca-certs" - optional: true + - name: istio-certs + secret: + secretName: istio.istio-ingressgateway-service-account + optional: true + - name: ingressgateway-certs + secret: + secretName: "istio-ingressgateway-certs" + optional: true + - name: ingressgateway-ca-certs + secret: + secretName: "istio-ingressgateway-ca-certs" + optional: true affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - - matchExpressions: - - key: beta.kubernetes.io/arch - operator: In - values: - - amd64 - - ppc64le - - s390x + - matchExpressions: + - key: beta.kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x preferredDuringSchedulingIgnoredDuringExecution: - - weight: 2 - preference: - matchExpressions: - - key: beta.kubernetes.io/arch - operator: In - values: - - amd64 - - weight: 2 - preference: - matchExpressions: - - key: beta.kubernetes.io/arch - operator: In - values: - - ppc64le - - weight: 2 - preference: - matchExpressions: - - key: beta.kubernetes.io/arch - operator: In - values: - - s390x + - weight: 2 + preference: + matchExpressions: + - key: beta.kubernetes.io/arch + operator: In + values: + - amd64 + - weight: 2 + preference: + matchExpressions: + - key: beta.kubernetes.io/arch + operator: In + values: + - ppc64le + - weight: 2 + preference: + matchExpressions: + - key: beta.kubernetes.io/arch + operator: In + values: + - s390x ``` ## Step 2: Update Knative Gateway