Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCU-2402] Remove KM and decK, and HTTPie instructions from comprehensive docs. #4137

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/styles/kong/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ opa
outbounds
passthrough
PayPal
petstore
plaintext
PowerShell
prepend
Expand Down
14 changes: 7 additions & 7 deletions app/_data/docs_nav_gateway_3.0.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ items:
- text: Comprehensive Guide
url: /get-started/comprehensive
items:
- text: Prepare to Administer
- text: Configure Services and Routes
url: /get-started/comprehensive/prepare
- text: Expose your Services
url: /get-started/comprehensive/expose-services
- text: Protect your Services
- text: Configure Rate Limiting
url: /get-started/comprehensive/protect-services
- text: Improve Performance
- text: Configure Proxy Caching
url: /get-started/comprehensive/improve-performance
- text: Secure Services
- text: Configure Key Authentication
url: /get-started/comprehensive/secure-services
- text: Set Up Intelligent Load Balancing
- text: Configure Load Balancing
url: /get-started/comprehensive/load-balancing
- text: Manage Administrative Teams
- text: Workspaces and Teams
url: /get-started/comprehensive/manage-teams
- text: Publish, Locate, and Consume Services
- text: Publish and Consume Services
url: /get-started/comprehensive/dev-portal

- title: Plan and Deploy
Expand Down
28 changes: 1 addition & 27 deletions src/gateway/get-started/comprehensive/dev-portal.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Publish, Locate, and Consume Services
title: Publish and Consume Services
badge: enterprise
---

Expand All @@ -11,37 +11,11 @@ Make sure the Dev Portal is on. You should have enabled it during [installation]

## Enable the Dev Portal for a Workspace

{% navtabs %}
{% navtab Using Kong Manager %}

1. In Kong Manager, open the Workspaces tab and open your workspace (for example, SecureWorkspace).

2. Scroll down in the sidebar, then click the **Overview** link under the Dev Portal section.

3. Click **Enable Developer Portal** and refresh the browser page.

{% endnavtab %}
{% navtab Using the Admin API %}

<!-- codeblock tabs -->
{% navtabs codeblock %}
{% navtab cURL %}
```sh
curl -X PATCH http://<admin-hostname>:8001/workspaces/SecureWorkspace \
--data config.portal=true
```
{% endnavtab %}
{% navtab HTTPie %}
```sh
http -f PATCH http://<admin-hostname>:8001/workspaces/SecureWorkspace \
config.portal=true
```
{% endnavtab %}
{% endnavtabs %}
<!-- end codeblock tabs -->

{% endnavtab %}
{% endnavtabs %}
This will expose the Dev Portal at `http://<admin-hostname>:8003/SecureWorkspace.`

After the Dev Portal is enabled for the Workspace, a few new links appear in the left navigation menu. It may take a few seconds for the Settings page to populate.
Expand Down
246 changes: 6 additions & 240 deletions src/gateway/get-started/comprehensive/expose-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you are not following the Getting Started workflow, make sure you have
## What are Services and Routes?

**Service** and **Route** objects let you expose your services to clients with
Kong Gateway. When configuring access to your API, you’ll start by specifying a
{{site.base_gateway}}. When configuring access to your API, you’ll start by specifying a
Service. In {{site.base_gateway}}, a Service is an entity representing an external
Guaris marked this conversation as resolved.
Show resolved Hide resolved
upstream API or microservice &mdash; for example, a data transformation
microservice, a billing API, and so on.
Expand All @@ -25,7 +25,7 @@ protocol, host, port, and path individually.

Before you can start making requests against the Service, you will need to add
a Route to it. Routes determine how (and if) requests are sent to their Services
after they reach Kong Gateway. A single Service can have many Routes.
after they reach {{site.base_gateway}}. A single Service can have many Routes.

After configuring the Service and the Route, you’ll be able to start making
requests through {{site.base_gateway}}.
Expand All @@ -46,278 +46,44 @@ Gateway proxies API requests.
configuration, including adding Services and Routes, is done through requests to
the Admin API.

{% navtabs %}
{% navtab Using Kong Manager %}

1. On the Workspaces tab in Kong Manager, scroll to the Workspace section and
click the **default** workspace.

This example uses the default workspace, but you can also create a new
workspace, or use an existing workspace.

2. Scroll down to **Services** and click **Add a Service**.

3. In the **Create Service** dialog, enter the name `example_service` and the
URL `http://mockbin.org`.

4. Click **Create**.

The service is created, and the page automatically redirects back to the
`example_service` overview page.
{% endnavtab %}
{% navtab Using the Admin API %}

<!-- codeblock tabs -->
{% navtabs codeblock %}
{% navtab cURL %}
```sh
curl -i -X POST http://<kong-admin-host>:8001/services \
curl -i -X POST http://localhost:8001/services \
--data name=example_service \
--data url='http://mockbin.org'
```
{% endnavtab %}
{% navtab HTTPie %}
```sh
http POST http://<kong-admin-host>:8001/services \
name=example_service \
url='http://mockbin.org'
```
{% endnavtab %}
{% endnavtabs %}
<!-- end codeblock tabs -->

If the service is created successfully, you'll get a 201 success message.

Verify the service’s endpoint:

<!-- codeblock tabs -->
{% navtabs codeblock %}
{% navtab cURL %}
```sh
curl -i http://<admin-hostname>:8001/services/example_service
```
{% endnavtab %}
{% navtab HTTPie %}
```sh
http http://<kong-admin-host>:8001/services/example_service
curl -i http://localhost:8001/services/example_service
```
{% endnavtab %}
{% endnavtabs %}
<!-- end codeblock tabs -->

{% endnavtab %}
{% navtab Using decK (YAML) %}

1. In the `kong.yaml` file you exported in
[Prepare to Administer {{site.base_gateway}}](/gateway/{{page.kong_version}}/get-started/comprehensive/prepare/#verify-the-kong-gateway-configuration),
define a Service with the name `example_service` and the URL
`http://mockbin.org`:

``` yaml
_format_version: "1.1"
services:
- host: mockbin.org
name: example_service
port: 80
protocol: http
```
2. Save the file. From your terminal, sync the configuration to update your
gateway instance:

``` bash
deck sync
```

The message should show that you’re creating a service:

```
creating service example_service
Summary:
Created: 1
Updated: 0
Deleted: 0
```

{% endnavtab %}
{% endnavtabs %}

## Add a Route

For the Service to be accessible through the API gateway, you need to add a
Route to it.

{% navtabs %}
{% navtab Using Kong Manager %}
1. From the `example_service` overview page, scroll down to the Routes section
and click **Add Route**.

The Create Route dialog displays with the Service field auto-populated with
the Service name and ID number. This field is required.

**Note:** If the Service field is not automatically populated, click
**Services** in the left navigation pane. Find your Service, click the
clipboard icon next to the id field, then go back to the Create Route
page and paste it into the Service field.

2. Enter a name for the Route, and at least one of the following fields: Host,
Methods, or Paths. For this example, use the following:
1. For **Name**, enter `mocking`.
2. For **Path(s)**, click **Add Path** and enter `/mock`.

3. Click **Create**.

The Route is created and you are automatically redirected back to the
`example_service` overview page. The new Route appears under the Routes section.

{% endnavtab %}
{% navtab Using the Admin API %}

Define a Route (`/mock`) for the Service (`example_service`) with a specific
path that clients need to request. Note at least one of the hosts, paths, or
methods must be set for the Route to be matched to the service.

<!-- codeblock tabs -->
{% navtabs codeblock %}
{% navtab cURL %}
```sh
curl -i -X POST http://<admin-hostname>:8001/services/example_service/routes \
curl -i -X POST http://localhost:8001/services/example_service/routes \
--data 'paths[]=/mock' \
--data name=mocking
```
{% endnavtab %}
{% navtab HTTPie %}
```sh
http :8001/services/example_service/routes \
paths:='["/mock"]' \
name=mocking
```
{% endnavtab %}
{% endnavtabs %}
<!-- end codeblock tabs -->

A `201` message indicates the Route was created successfully.

{% endnavtab %}
{% navtab Using decK (YAML) %}

1. Paste the following into the `kong.yaml` file, under the entry for
`example_service`:

``` yaml
routes:
- name: mocking
paths:
- /mock
strip_path: true
```

Your file should now look like this:

``` yaml
_format_version: "1.1"
services:
- host: mockbin.org
name: example_service
port: 80
protocol: http
routes:
- name: mocking
paths:
- /mock
strip_path: true
```

2. Sync the configuration:

``` bash
deck sync
```

3. (Optional) You can update your local file with the new configuration:

<div class="alert alert-warning">

<strong>Be careful!</strong> Any subsequent <code>deck dump</code> will
overwrite the existing <code>kong.yaml</code> file. Create backups as needed.
</div>

``` bash
$ deck dump
```

Alternatively, you will also see this configuration in the diff that decK
shows when you're syncing a change to the configuration.

You'll notice that both the Service and Route now have parameters that you
did not explicitly set. These are default parameters that every Service and
Route are created with:

``` yaml
services:
- connect_timeout: 60000
host: mockbin.org
name: example_service
port: 80
protocol: http
read_timeout: 60000
retries: 5
write_timeout: 60000
routes:
- name: mocking
paths:
- /mock
path_handling: v0
preserve_host: false
protocols:
- http
- https
regex_priority: 0
strip_path: true
https_redirect_status_code: 426
```

You can do this after any `deck sync` to see {{site.base_gateway}}'s most
recent configuration.

The rest of this guide continues using the simplified version of the
configuration file without performing a `deck dump` for every step, to keep
it easy to follow.

{% endnavtab %}
{% endnavtabs %}

## Verify the Route is forwarding requests to the Service

By default, {{site.base_gateway}} handles proxy requests on port `8000`. The proxy is often referred to as the data plane.

{% navtabs %}
{% navtab Using a Web Browser %}

From a web browser, navigate to `http://<kong-gateway-host>:8000/mock/request`.

{% endnavtab %}

{% navtab Using the Admin API %}

<!-- codeblock tabs -->
{% navtabs codeblock %}
{% navtab cURL %}
```sh
curl -i -X GET http://<admin-hostname>:8000/mock/request
```
{% endnavtab %}
{% navtab HTTPie %}
```sh
http http://<admin-hostname>:8000/mock/request
curl -i -X GET http://localhost:8000/mock/request
```
{% endnavtab %}
{% endnavtabs %}
<!-- end codeblock tabs -->

{% endnavtab %}
{% endnavtabs %}


## Summary and next steps

In this section, you:
Expand Down
Loading