Create a Dev Portal and publish content

TL;DR

Create a Portal, attach a published PortalPage, and apply a PortalCustomization.

Prerequisites

This page is part of the Get started with Kong Operator and Dev Portal CRDs series.

Complete the previous page, Install Kong Operator for Dev Portal before completing this page.

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
kubectl create namespace kong --dry-run=client -o yaml | kubectl apply -f -
echo '
kind: KonnectAPIAuthConfiguration
apiVersion: konnect.konghq.com/v1alpha1
metadata:
  name: konnect-api-auth
  namespace: kong
spec:
  type: token
  token: "'$KONNECT_TOKEN'"
  serverURL: us.api.konghq.com
' | kubectl apply -f -

Create the Portal

The Portal represents the Dev Portal itself in Konnect and provides the parent object for pages, customizations, teams, and sign-in settings. For more information, see the Dev Portal overview.

  1. Create the Portal resource:

    echo '
    apiVersion: konnect.konghq.com/v1alpha1
    kind: Portal
    metadata:
      name: operator-dev-portal
      namespace: kong
    spec:
      konnect:
        authRef:
          name: konnect-api-auth
      apiSpec:
        name: operator-dev-portal
        displayName: Operator Dev Portal
        description: Developer portal managed by Kong Operator
        authenticationEnabled: Enabled
        defaultPageVisibility: public
        defaultAPIVisibility: private
    ' | kubectl apply -f -
  2. Wait for the resource to be ready:

    kubectl wait portal/operator-dev-portal -n kong \
      --for=condition=Programmed=True \
      --timeout=10m

Create a PortalPage

The PortalPage adds published content to the portal. For more information, see Dev Portal pages and content.

  1. Create the PortalPage resource:

    echo '
    apiVersion: konnect.konghq.com/v1alpha1
    kind: PortalPage
    metadata:
      name: operator-dev-portal-getting-started
      namespace: kong
    spec:
      portalRef:
        type: namespacedRef
        namespacedRef:
          name: operator-dev-portal
      apiSpec:
        title: Getting Started
        slug: getting-started
        description: Landing page for the developer portal
        content: |
          # Getting Started
    
          Welcome to the developer portal managed by Kong Operator.
        status: published
        visibility: public
    ' | kubectl apply -f -
  2. Wait for the resource to be ready:

    kubectl wait portalpage/operator-dev-portal-getting-started -n kong \
      --for=condition=Programmed=True \
      --timeout=10m

Create a PortalCustomization

The PortalCustomization lets you change the portal’s layout, navigation, and branding. For more information, see Dev Portal customizations.

  1. Create the PortalCustomization resource:

    echo '
    apiVersion: konnect.konghq.com/v1alpha1
    kind: PortalCustomization
    metadata:
      name: operator-dev-portal-customization
      namespace: kong
    spec:
      portalRef:
        type: namespacedRef
        namespacedRef:
          name: operator-dev-portal
      apiSpec:
        css: |
          body { background-color: #f6f7fb; }
    ' | kubectl apply -f -
  2. Wait for the resource to be ready:

    kubectl wait portalcustomization/operator-dev-portal-customization -n kong \
      --for=condition=Programmed=True \
      --timeout=10m

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!