Prerequisites for Kubernetes integration

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

This topic explains the steps that you must complete before you install Edge Microgateway as a service in a Kubernetes cluster.

This topic discusses:

  • The minimum requirements for your Kubernetes cluster.
  • How to install and configure Edge Microgateway.
  • How to install the base configuration of Edge Microgateway into your Kubernetes cluster.

Requirements for your Kubernetes cluster

Your Kubernetes cluster requires:

  • Kubernetes version 1.9 or higher.
  • Kubernetes CLI kubectl v1.9 or greater.
  • A cluster with at least 3 nodes having 2 vCPUs each.

Example: Creating a Kubernetes cluster on Google Kubernetes Engine (GKE)

Set up your Kubernetes administration machine

The Kubernetes administration machine is your local machine that you use to run commands against your Kubernetes cluster. This machine is typically a desktop machine that has access to your Kubernetes VMs.

You must install the following utilities on the Kubernetes administration machine:

  • Install the kubectl command line interface 1.9 or later.

  • (GKE only) Install gcloud if you are running Kubernetes on GKE.

Create a Kubernetes cluster on GKE

  1. Log in to the Google Kubernetes Engine (GKE) dashboard on Google Cloud Platform (GCP).
  2. Click Create Cluster.
  3. Select Standard Cluster.
  4. Enter a name for your cluster.
  5. Select a Zone.
  6. Select Cluster Version 1.9.7-gke-*. For example 1.9.7-gke.6.
  7. Select a size of 3 nodes.
  8. Select 2 vCPUs with 7.5 GB memory.
  9. Click Create.

    The following screenshot shows the GKE dashboard filled in as described in the previous steps:

    GKE dashboard

Get your cluster credentials

  1. Set your GKE project name:

    gcloud config set project projectName
  2. Set your GKE project zone:

    gcloud config set compute/zone zoneName
  3. Get your gcloud container credentials:

    gcloud container clusters get-credentials cluster-name --zone zone --project project-name

    where:

    • cluster-name is the name of the Kubernetes cluster you created.
    • zone is the zone where your cluster is located.
    • project-name is your GCP project name.

    For example:

    gcloud container clusters get-credentials edgemicrogateway-cluster --zone us-central1-a --project edgemicro-project
  4. Execute the following command exactly as shown. The command grants cluster admin permissions to the current user. Admin permissions are required to create the necessary RBAC rules for the Edge Microgateway service:

    kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value core/account)
    

Install Edge Microgateway for Kubernetes

  1. Download Edge Microgateway for Kubernetes. If you are on a MacOS or Linux machine, you can download the latest version or a particular version by specifying the version name.

    To get the latest version:

    curl -L https://raw.githubusercontent.com/apigee-internal/microgateway/master/kubernetes/release/downloadEdgeMicrok8s.sh | sh -

    To get a particular version by version number. Note the version number must be prefixed with the letter "v". For example: v3.0.2

    curl -L https://raw.githubusercontent.com/apigee-internal/microgateway/master/kubernetes/release/downloadEdgeMicrok8s.sh | sh -s  version

    For example:

    curl -L https://raw.githubusercontent.com/apigee-internal/microgateway/master/kubernetes/release/downloadEdgeMicrok8s.sh | sh -s v3.0.2
  2. Change directory to the install directory microgateway_Version_OS_ARCH. For example:

    cd microgateway_2.5.26_Darwin_x86_64
  3. Examine the install directory:

    • /install/kubernetes - Configuration .yaml files for deployment to Kubernetes.
    • /samples - Sample applications for testing your installation.
    • /bin - The edgemicroctl executable. The edgemicroctl command injects Edge Microgateway into Kubernetes
  4. Add the edgemicroctl client to your PATH. For example, run the following command on a MacOS or Linux system:

    export PATH=$PWD/bin:$PATH
  5. Apply the base Edge Microgateway setup to the Kubernetes cluster. The following command creates an edgemicro-system namespace and cluster roles.

    kubectl apply -f install/kubernetes/edgemicro.yaml
  6. Install the NGINX Ingress controller into the cluster. Be sure that no other Nginix controller is running. You can check by running kubectl get pods.

    kubectl apply -f install/kubernetes/edgemicro-nginx-gke.yaml

Verify the installation

  1. To check if the Ingress controller has started, run the following command:

    kubectl get pods --all-namespaces -l app=edgemicro-ingress --watch

    As the following sample output shows, it takes a minute or two for the processes to start. It is normal to see several Error and Restart cycles before the STATUS changes to Running.

    NAMESPACE          NAME                                            READY     STATUS             RESTARTS   AGE
    edgemicro-system   edgemicro-ingress-controller-64444469bf-wjhrn   0/1       CrashLoopBackOff   1          33s
    edgemicro-system   edgemicro-ingress-controller-64444469bf-wjhrn   0/1       Error              2          33s
    edgemicro-system   edgemicro-ingress-controller-64444469bf-wjhrn   0/1       CrashLoopBackOff   2          40s
    edgemicro-system   edgemicro-ingress-controller-64444469bf-wjhrn   0/1       Running            3          1m
    edgemicro-system   edgemicro-ingress-controller-64444469bf-wjhrn   1/1       Running            3          1m
    
  2. Once the Ingress is running, you can cancel the above command by typing Ctrl+C.

  3. Run this command to check that the Kubernetes services are deployed. You should see output similar to the example output shown below:

    kubectl get svc -n edgemicro-system
    

    Example output:

    NAME                        TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                     AGE
    default-http-backend        ClusterIP      10.19.255.106  <none>         80/TCP                       2h
    edgemicro-ingress           LoadBalancer   10.19.247.156  35.224.24.13   80:30176/TCP,443:32325/TCP   2h
    
  4. Verify all pods are running:

    kubectl get pods -n edgemicro-system
    

    Example output:

    NAME                                            READY     STATUS    RESTARTS   AGE
    default-http-backend-55c6c69b88-2lvtw           1/1       Running   0          4m
    edgemicro-ingress-controller-64444469bf-wjhrn   1/1       Running   3          4m
    

Install Edge Microgateway

  1. You must have Edge Microgateway 2.5.26 or a later version installed. You can check by entering:

    edgemicro --version
  2. If you have not have Edge Microgateway 2.5.26 or later installed, execute the install script:

    npm install edgemicro -g
  3. If you just installed Edge Microgateway for the first time or upgraded it, run this command:

    edgemicro init

    If you need additional help, see Installing Edge Microgateway.

Next step

Now you are ready to deploy Edge Microgateway to Kubernetes.