mirror of https://github.com/knative/docs.git
Format markdown (#914)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
This commit is contained in:
parent
133f43ede9
commit
1ed88cadd7
|
@ -16,8 +16,8 @@ commands will need to be adjusted for use in a Windows environment.
|
||||||
|
|
||||||
## Installing Glooctl
|
## Installing Glooctl
|
||||||
|
|
||||||
This installation method for Knative depends on Gloo. Run the following
|
This installation method for Knative depends on Gloo. Run the following to
|
||||||
to install `glooctl`, the Gloo command line.
|
install `glooctl`, the Gloo command line.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -sL https://run.solo.io/gloo/install | sh
|
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
|
> Note: To see the content of the kubernetes manifest glooctl installs, run
|
||||||
> `glooctl install knative --dry-run`.
|
> `glooctl install knative --dry-run`. Monitor the Gloo components until all of
|
||||||
Monitor the Gloo components until all of the components show a `STATUS` of
|
> the components show a `STATUS` of `Running` or `Completed`:
|
||||||
`Running` or `Completed`:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get pods --namespace gloo-system
|
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)
|
[Getting Started with Knative App Deployment](getting-started-knative-app.md)
|
||||||
guide.
|
guide.
|
||||||
|
|
||||||
Note that when you've finished deploying the app, you'll need to connect to the Gloo
|
Note that when you've finished deploying the app, you'll need to connect to the
|
||||||
Gateway rather than the Istio Gateway.
|
Gloo Gateway rather than the Istio Gateway.
|
||||||
|
|
||||||
To get the URL of the Gloo Gateway, run
|
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
|
curl -H "Host: helloworld-go.myproject.example.com" $GATEWAY_URL
|
||||||
```
|
```
|
||||||
|
|
||||||
The full instructions for the [Go Hello-World Sample](../serving/samples/helloworld-go) with
|
The full instructions for the
|
||||||
this substitution are published bellow:
|
[Go Hello-World Sample](../serving/samples/helloworld-go) with this substitution
|
||||||
|
are published bellow:
|
||||||
|
|
||||||
### Deploy the Hello-World Go App:
|
### 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
|
```go
|
||||||
package main
|
package main
|
||||||
|
@ -169,9 +169,8 @@ ENV PORT 8080
|
||||||
CMD ["/helloworld"]
|
CMD ["/helloworld"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a new file, `service.yaml` and copy the following service definition
|
Create a new file, `service.yaml` and copy the following service definition into
|
||||||
into the file. Make sure to replace `{username}` with your Docker Hub
|
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
|
||||||
|
@ -205,23 +204,24 @@ docker build -t {username}/helloworld-go .
|
||||||
docker push {username}/helloworld-go
|
docker push {username}/helloworld-go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
After the build has completed and the container is pushed to docker hub, you can
|
||||||
After the build has completed and the container is pushed to docker hub, you
|
deploy the app into your cluster. Ensure that the container image value in
|
||||||
can deploy the app into your cluster. Ensure that the container image value
|
`service.yaml` matches the container you built in the previous step. Apply the
|
||||||
in `service.yaml` matches the container you built in the previous step. Apply
|
configuration using `kubectl`:
|
||||||
the configuration using `kubectl`:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl apply --filename service.yaml
|
kubectl apply --filename service.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Now that your service is created, Knative will perform the following steps:
|
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
|
```bash
|
||||||
CLUSTERINGRESS_URL=$(glooctl proxy url --name clusteringress-proxy)
|
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
|
```bash
|
||||||
kubectl get ksvc helloworld-go -n default --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
kubectl get ksvc helloworld-go -n default --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
|
||||||
````
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
@ -242,14 +242,14 @@ NAME DOMAIN
|
||||||
helloworld-go helloworld-go.default.example.com
|
helloworld-go helloworld-go.default.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Test your app by sending it a request. Use the following `curl` command with
|
Test your app by sending it a request. Use the following `curl` command with the
|
||||||
the domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address
|
domain URL `helloworld-go.default.example.com` and `EXTERNAL-IP` address that
|
||||||
that you retrieved in the previous steps:
|
you retrieved in the previous steps:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -H "Host: helloworld-go.default.example.com" ${CLUSTERINGRESS_URL}
|
curl -H "Host: helloworld-go.default.example.com" ${CLUSTERINGRESS_URL}
|
||||||
Hello Go Sample v1!
|
Hello Go Sample v1!
|
||||||
````
|
```
|
||||||
|
|
||||||
> Note: Add `-v` option to get more detail if the `curl` command failed.
|
> 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
|
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.
|
||||||
|
|
|
@ -20,20 +20,26 @@ clusters.
|
||||||
|
|
||||||
## Installing Knative
|
## 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:
|
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
|
## 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*
|
[Install with Gloo](Knative-with-Gloo.md): Gloo functions as a lightweight
|
||||||
is not supported by Gloo at this time.
|
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
|
## Installing Knative with Istio
|
||||||
|
|
||||||
Istio is a popular service mesh that includes a Knative-compatiblle
|
Istio is a popular service mesh that includes a Knative-compatiblle ingress.
|
||||||
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.
|
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:
|
There are several options when installing Knative:
|
||||||
|
|
||||||
|
|
|
@ -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}"`
|
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
|
```shell
|
||||||
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
|
docker run -ti --entrypoint=/client docker.io/{username}/grpc-ping-go \
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Knative Secrets - Go sample
|
# Knative Secrets - Go sample
|
||||||
|
|
||||||
A simple web app written in Go that you can use for testing. It demonstrates
|
A simple web app written in Go that you can use for testing. It demonstrates how
|
||||||
how to use a Kubernetes secret as a Volume with Knative. We will create a new
|
to use a Kubernetes secret as a Volume with Knative. We will create a new Google
|
||||||
Google Service Account and place it into a Kubernetes secret, then we will
|
Service Account and place it into a Kubernetes secret, then we will mount it
|
||||||
mount it into a container as a Volume.
|
into a container as a Volume.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
@ -14,21 +14,20 @@ mount it into a container as a Volume.
|
||||||
and a Docker Hub account configured (we'll use it for a container registry).
|
and a Docker Hub account configured (we'll use it for a container registry).
|
||||||
- Create a
|
- Create a
|
||||||
[Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
|
[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
|
and install the `gcloud` CLI and run `gcloud auth login`. This sample will use
|
||||||
use a mix of `gcloud` and `kubectl` commands. The rest of the sample assumes
|
a mix of `gcloud` and `kubectl` commands. The rest of the sample assumes that
|
||||||
that you've set the `$PROJECT_ID` environment variable to your Google Cloud
|
you've set the `$PROJECT_ID` environment variable to your Google Cloud project
|
||||||
project id, and also set your project ID as default using
|
id, and also set your project ID as default using
|
||||||
`gcloud config set project $PROJECT_ID`.
|
`gcloud config set project $PROJECT_ID`.
|
||||||
|
|
||||||
|
|
||||||
## Recreating the sample code
|
## Recreating the sample code
|
||||||
|
|
||||||
While you can clone all of the code from this directory, simple apps are
|
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
|
generally more useful if you build them step-by-step. The following instructions
|
||||||
recreate the source files from this folder.
|
recreate the source files from this folder.
|
||||||
|
|
||||||
1. Create a new file named `secrets.go` and paste the following code. This
|
1. Create a new file named `secrets.go` and paste the following code. This code
|
||||||
code creates a basic web server which listens on port 8080:
|
creates a basic web server which listens on port 8080:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
@ -124,10 +123,9 @@ recreate the source files from this folder.
|
||||||
CMD ["/hellosecrets"]
|
CMD ["/hellosecrets"]
|
||||||
```
|
```
|
||||||
|
|
||||||
1. [Create a new Google Service Account](
|
1. [Create a new Google Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts).
|
||||||
https://cloud.google.com/iam/docs/creating-managing-service-accounts). This Service
|
This Service Account doesn't need any privileges, the GCS bucket has been
|
||||||
Account doesn't need any privileges, the GCS bucket has been configured so that any
|
configured so that any authenticated identity may read it.
|
||||||
authenticated identity may read it.
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
gcloud iam service-accounts create knative-secrets
|
gcloud iam service-accounts create knative-secrets
|
||||||
|
@ -222,6 +220,7 @@ folder) you're ready to build and deploy the sample app.
|
||||||
```
|
```
|
||||||
|
|
||||||
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 balance
|
- Network programming to create a route, ingress, service, and load balance
|
||||||
for your app.
|
for your app.
|
||||||
|
|
Loading…
Reference in New Issue