Format markdown (#914)

Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
This commit is contained in:
mattmoor-sockpuppet 2019-02-20 09:43:46 -08:00 committed by Knative Prow Robot
parent 133f43ede9
commit 1ed88cadd7
4 changed files with 102 additions and 95 deletions

View File

@ -16,8 +16,8 @@ commands will need to be adjusted for use in a Windows environment.
## Installing Glooctl
This installation method for Knative depends on Gloo. Run the following
to install `glooctl`, the Gloo command line.
This installation method for Knative depends on Gloo. Run the following to
install `glooctl`, the Gloo command line.
```shell
curl -sL https://run.solo.io/gloo/install | sh
@ -47,9 +47,8 @@ glooctl install knative
```
> Note: To see the content of the kubernetes manifest glooctl installs, run
> `glooctl install knative --dry-run`.
Monitor the Gloo components until all of the components show a `STATUS` of
`Running` or `Completed`:
> `glooctl install knative --dry-run`. Monitor the Gloo components until all of
> the components show a `STATUS` of `Running` or `Completed`:
```shell
kubectl get pods --namespace gloo-system
@ -74,8 +73,8 @@ To deploy your first app with Knative, follow the step-by-step
[Getting Started with Knative App Deployment](getting-started-knative-app.md)
guide.
Note that when you've finished deploying the app, you'll need to connect to the Gloo
Gateway rather than the Istio Gateway.
Note that when you've finished deploying the app, you'll need to connect to the
Gloo Gateway rather than the Istio Gateway.
To get the URL of the Gloo Gateway, run
@ -94,13 +93,14 @@ export GATEWAY_URL=$(glooctl proxy url --name clusteringress-proxy)
curl -H "Host: helloworld-go.myproject.example.com" $GATEWAY_URL
```
The full instructions for the [Go Hello-World Sample](../serving/samples/helloworld-go) with
this substitution are published bellow:
The full instructions for the
[Go Hello-World Sample](../serving/samples/helloworld-go) with this substitution
are published bellow:
### Deploy the Hello-World Go App:
Create a new file named `helloworld.go` and paste the following code. This code creates a basic web server which listens on port 8080:
Create a new file named `helloworld.go` and paste the following code. This code
creates a basic web server which listens on port 8080:
```go
package main
@ -169,9 +169,8 @@ ENV PORT 8080
CMD ["/helloworld"]
```
Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
username.
Create a new file, `service.yaml` and copy the following service definition into
the file. Make sure to replace `{username}` with your Docker Hub username.
```yaml
apiVersion: serving.knative.dev/v1alpha1
@ -205,23 +204,24 @@ docker build -t {username}/helloworld-go .
docker push {username}/helloworld-go
```
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
in `service.yaml` matches the container you built in the previous step. Apply
the configuration using `kubectl`:
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 in
`service.yaml` matches the container you built in the previous step. Apply the
configuration using `kubectl`:
```bash
kubectl apply --filename service.yaml
```
Now that your service is created, Knative will perform the following steps:
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance
for your app.
- Automatically scale your pods up and down (including to zero active pods).
- Run the following command to find the external IP address for the Gloo cluster ingress.
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance for
your app.
- Automatically scale your pods up and down (including to zero active pods).
- Run the following command to find the external IP address for the Gloo cluster
ingress.
```bash
CLUSTERINGRESS_URL=$(glooctl proxy url --name clusteringress-proxy)
@ -233,7 +233,7 @@ Run the following command to find the domain URL for your service:
```bash
kubectl get ksvc helloworld-go -n default --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
````
```
Example:
@ -242,14 +242,14 @@ NAME DOMAIN
helloworld-go helloworld-go.default.example.com
```
Test your app by sending it a request. Use the following `curl` command with
the domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address
that you retrieved in the previous steps:
Test your app by sending it a request. Use the following `curl` command with the
domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address that
you retrieved in the previous steps:
```bash
curl -H "Host: helloworld-go.default.example.com" ${CLUSTERINGRESS_URL}
Hello Go Sample v1!
````
```
> Note: Add `-v` option to get more detail if the `curl` command failed.
@ -260,4 +260,5 @@ To remove the sample app from your cluster, delete the service record:
kubectl delete --filename service.yaml
```
Great! our Knative ingress is up and running. See https://github.com/knative/docs for more information on using Knative.
Great! our Knative ingress is up and running. See
https://github.com/knative/docs for more information on using Knative.

View File

@ -20,20 +20,26 @@ clusters.
## Installing Knative
Knative depends on an Ingress/Gateway which is capable of routing requests to Knative Services.
Knative depends on an Ingress/Gateway which is capable of routing requests to
Knative Services.
Currently, two options exist which provide this functionality:
[Istio](https://istio.io/), the Envoy-based Service Mesh, and [Gloo](https://gloo.solo.io/), the Envoy-based API Gateway.
[Istio](https://istio.io/), the Envoy-based Service Mesh, and
[Gloo](https://gloo.solo.io/), the Envoy-based API Gateway.
## Installing Knative with Gloo
[Install with Gloo](Knative-with-Gloo.md): Gloo functions as a lightweight gateway for Knative. Choose this option if you don't require service mesh in your cluster and want a lighter-weight alternative to Istio. Note that *the Knative Eventing component*
is not supported by Gloo at this time.
[Install with Gloo](Knative-with-Gloo.md): Gloo functions as a lightweight
gateway for Knative. Choose this option if you don't require service mesh in
your cluster and want a lighter-weight alternative to Istio. Note that _the
Knative Eventing component_ is not supported by Gloo at this time.
## Installing Knative with Istio
Istio is a popular service mesh that includes a Knative-compatiblle
ingress. Choose this option if you wish to use Istio service mesh features. You will also need to choose this installation option if you wish to use the Knative Eventing component, which currently depends on Istio.
Istio is a popular service mesh that includes a Knative-compatiblle ingress.
Choose this option if you wish to use Istio service mesh features. You will also
need to choose this installation option if you wish to use the Knative Eventing
component, which currently depends on Istio.
There are several options when installing Knative:

View File

@ -40,7 +40,8 @@ export SERVICE_HOST=`kubectl get route grpc-ping --output jsonpath="{.status.dom
export SERVICE_IP=`kubectl get svc istio-ingressgateway --namespace istio-system --output jsonpath="{.status.loadBalancer.ingress[*].ip}"`
```
1. Use the client to send message streams to the gRPC server (replacing `{username}`)
1. Use the client to send message streams to the gRPC server (replacing
`{username}`)
```shell
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \

View File

@ -1,9 +1,9 @@
# Knative Secrets - Go sample
A simple web app written in Go that you can use for testing. It demonstrates
how to use a Kubernetes secret as a Volume with Knative. We will create a new
Google Service Account and place it into a Kubernetes secret, then we will
mount it into a container as a Volume.
A simple web app written in Go that you can use for testing. It demonstrates how
to use a Kubernetes secret as a Volume with Knative. We will create a new Google
Service Account and place it into a Kubernetes secret, then we will mount it
into a container as a Volume.
## Prerequisites
@ -13,13 +13,12 @@ mount it into a container as a Volume.
- [Docker](https://www.docker.com) installed and running on your local machine,
and a Docker Hub account configured (we'll use it for a container registry).
- Create a
[Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
and install the `gcloud` CLI and run `gcloud auth login`. This sample will
use a mix of `gcloud` and `kubectl` commands. The rest of the sample assumes
that you've set the `$PROJECT_ID` environment variable to your Google Cloud
project id, and also set your project ID as default using
`gcloud config set project $PROJECT_ID`.
[Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
and install the `gcloud` CLI and run `gcloud auth login`. This sample will use
a mix of `gcloud` and `kubectl` commands. The rest of the sample assumes that
you've set the `$PROJECT_ID` environment variable to your Google Cloud project
id, and also set your project ID as default using
`gcloud config set project $PROJECT_ID`.
## Recreating the sample code
@ -27,8 +26,8 @@ While you can clone all of the code from this directory, simple apps are
generally more useful if you build them step-by-step. The following instructions
recreate the source files from this folder.
1. Create a new file named `secrets.go` and paste the following code. This
code creates a basic web server which listens on port 8080:
1. Create a new file named `secrets.go` and paste the following code. This code
creates a basic web server which listens on port 8080:
```go
package main
@ -124,10 +123,9 @@ recreate the source files from this folder.
CMD ["/hellosecrets"]
```
1. [Create a new Google Service Account](
https://cloud.google.com/iam/docs/creating-managing-service-accounts). This Service
Account doesn't need any privileges, the GCS bucket has been configured so that any
authenticated identity may read it.
1. [Create a new Google Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts).
This Service Account doesn't need any privileges, the GCS bucket has been
configured so that any authenticated identity may read it.
```shell
gcloud iam service-accounts create knative-secrets
@ -170,29 +168,29 @@ authenticated identity may read it.
image: docker.io/{username}/secrets-go
env:
# This directs the Google Cloud SDK to use the identity and project
# defined by the Service Account (aka robot) in the JSON file at
# this path.
# - `/var/secret` is determined by the `volumeMounts[0].mountPath`
# below. This can be changed if both places are changed.
# - `robot.json` is determined by the "key" that is used to hold the
# secret content in the Kubernetes secret. This can be changed
# if both places are changed.
- name: GOOGLE_APPLICATION_DEFAULT
value: /var/secret/robot.json
# This directs the Google Cloud SDK to use the identity and project
# defined by the Service Account (aka robot) in the JSON file at
# this path.
# - `/var/secret` is determined by the `volumeMounts[0].mountPath`
# below. This can be changed if both places are changed.
# - `robot.json` is determined by the "key" that is used to hold the
# secret content in the Kubernetes secret. This can be changed
# if both places are changed.
- name: GOOGLE_APPLICATION_DEFAULT
value: /var/secret/robot.json
# This section specified where in the container we want the
# volume containing our secret to be mounted.
volumeMounts:
- name: robot-secret
mountPath: /var/secret
- name: robot-secret
mountPath: /var/secret
# This section attaches the secret "google-robot-secret" to
# the Pod holding the user container.
volumes:
- name: robot-secret
secret:
secretName: google-robot-secret
- name: robot-secret
secret:
secretName: google-robot-secret
```
## Building and deploying the sample
@ -222,10 +220,11 @@ folder) you're ready to build and deploy the sample app.
```
1. Now that your service is created, Knative will perform the following steps:
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance
for your app.
- Automatically scale your pods up and down (including to zero active pods).
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balance
for your app.
- Automatically scale your pods up and down (including to zero active pods).
1. Run the following command to find the external IP address for your service.
The ingress IP for your cluster is returned. If you just created your