Apigee AIO deployment on Kubernetes

Apigee AIO deployment on Kubernetes Clusters

Apigee can be deployed on Kubernetes clusters. This section covers deploying Apigee AIO docker image on a kubernetes cluster.

Prerequisite

  • Install kubectl tools on your development environment.
  • Docker tools on your development environment.
  • Kubernetes clusters in GKE, Amazon or Minikube.
  • License Key : The docker image does not contain a license key. Contact your Apigee account representative for a license key. If you don't know who your sales representative is, please send an email to edgesalesteam@google.com
  • Credentials to access Apigee Edge softwares.

Getting Started

  • If you are using docker on MacOS, Change the docker preference and uncheck the option of 'Securily store docker login in MacOS Chain'. This allows all auths entries in docker config file.
  • docker login docker.apigee.net
  • Provide credentials to access software.apigee.com
  • Create kubernetes secret for docker registry
kubectl create secret docker-registry apigeesecret  --docker-server=docker.apigee.net --docker-username=uName --docker-password=pWord --docker-email=email
  • Create a kubernetes deployment file named apigee.yaml as follows.
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: apigee-license
data:
  apigee-license.txt: 
---


kind: Service
apiVersion: v1
metadata:
  name: apigee
  labels:
    app: apigee
spec:
  ports:
  - name: admin-http
    protocol: TCP
    port: 9000
    targetPort: 9000
  - name: api-http
    protocol: TCP
    port: 9001
    targetPort: 9001
  - name: management-http
    protocol: TCP
    port: 8080
    targetPort: 8080
  - name: developer-http
    protocol: TCP
    port: 8079
    targetPort: 8079
  - name: monitoring-http
    protocol: TCP
    port: 3000
    targetPort: 3000
  selector:
    app: apigee
  type: LoadBalancer
  sessionAffinity: None


---


kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: apigee
  labels:
    app: apigee
  annotations:
    deployment.kubernetes.io/revision: 1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: apigee
  template:
    metadata:
      creationTimestamp: 
      labels:
        app: apigee
    spec:
      volumes:
      - name: empty-dir
        emptyDir: {}
      - name: apigee-data
        emptyDir: {}
      - name: apigee-customer
        emptyDir: {}
      - name: apigee-license
        configMap:
          name: apigee-license
          items:
          - key: apigee-license.txt
            path: license.txt
          defaultMode: 420
      containers:
      - name: apigee
        image: docker.apigee.net/apigee-edge-aio:latest
        ports:
        - containerPort: 9000
          name: admin-http
        - containerPort: 8080
          name: management-http
        - containerPort: 9001
          name: api-http
        - containerPort: 3000
          name: monitoring-http
        - containerPort: 8079
          name: developer-http
        resources: 
          limits:
            memory: "6144Mi"
            cpu: "2"
          requests:
            memory: "6144Mi"
            cpu: "1"
        volumeMounts:
        - name: apigee-data
          mountPath: "/opt/apigee/data"
        - name: apigee-customer
          mountPath: "/opt/apigee/customer"
        - name: apigee-license
          mountPath: "/opt/apigee/license"
        terminationMessagePath: "/dev/termination-log"
        terminationMessagePolicy: File
        imagePullPolicy: Always
        securityContext:
          privileged: true
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext:
        fsGroup: 998
      schedulerName: default-scheduler
      imagePullSecrets:
      - name: apigeesecret
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600


---

  • Edit the apigee.yaml just created above and edit the apigee-license.txt: section and paste your license text with no line breaks.
cat license.txt | tr -d '\n'

JakHrOe9fuHhHyJzxqJ5uXlQrzk/vo/PaJpEg/NXN1kKKGQuBkv0o1BVnoRsGlMMxGK3DmShvQlFFHYWJIqCcJ2woZn3TfuFf0t7LSmWSoPxpPRUVM7NS3mXv3UtVp5XjFajEiByyGaejNrShgOiKmveJkczmcWqdT60zaqD1iUJxluJYF8NtiKkIvW01Oa6PZcuaWZql8UV6KicnWnZJZzdLhTZskwz+DqcwNf0R1+UaFaPg==
  • Create the apigee deployment
kubectl create -f apigee.yaml
  • Execute the command to get external IP kubectl get svc | grep apigee-edge-aio-service
kubectl get svc | grep apigee-edge-aio-service
apigee-edge-aio-service   10.59.246.104   35.192.166.250   9000:31524/TCP,8080:32399/TCP,9001:31931/TCP   5m
  • If you are using minikube, you won't get public ip. In that case you can use the private ip for the next steps
  • Wait for few minutes till the services are up. You can check http://35.192.166.250:9000 to check if UI comes up. If the UI doesn't come up within 5 minutes, troubleshoot issues.
  • Test apigee edge deployment
  • In this install, Apigee Edge exposes:
    The Administration UI on port 9000 
    The APIs on port 9001
    The Management APIs on port 8080
    The Developer Port: 8079
    The Monitoring Dashboard: 3000
    Monitoring Dashboard Credentials: admin/admin
    Edge UI Admin user: trial@apigee.com
    Edge UI Admin password: Secret123
    [Applies to Edge UI and Developer Portal]
    
    You can access through browser http://35.192.166.250:9000
  • Execute curl command to update Virtual hosts with the external IP address
curl -X POST -H "Content-Type: application/json" -u trial@apigee.com:Secret123 http://35.192.166.250:8080/v1/organizations/trial/environments/test/virtualhosts/default -d '{"name": "default" , "hostAliases": ["35.192.166.250"], "port": "9001","interfaces" : []}'

Clean up deployment

kubectl delete -f apigee.yaml
kubectl delete secret apigeesecret

Note:

Although it's possible to run AIO on Kubernetes, it's not supported by Apigee Support. However, as we make, measure, learn and adapt, we welcome and encourage questions and feedback on community.apigee.com.

Comments
Not applicable

Hi ,

I am developing microservices. I am planning to use Kubernetes for cluster management and leverage APIGEE Edge as gateway on top of microservices for API management.

How can I manage service discovery in APIGEE for my microservices.

I watched the webinar

https://apigee.com/about/blog/digital-business/api-management-kubernetes

to get an idea of achieving the same.

Can I get more specific details from implementation perspective.

rajeshmi
Staff

As I understand, for microservices, you can leverage Apigee Edge micro gateways. The service discovery still happens the same way as any api services developed in edge. Adding @Srinandan Sridhar for more comments

Former Community Member
Not applicable

I agree with @rajeshmishra. If you are looking to add API Management within k8s today, then microgateway is an option.

However, this space is changing quickly. As you may be aware, Google is investing in Istion (https://istio.io/). Our roadmap has plans to integrate Apigee with Istio. If your enterprise is interested in these plans, please reach out to your Apigee account exec about this.

rajeshmi
Staff

Please refer this document for latest on deploying to kubernetes : https://community.apigee.com/articles/42562/apigee-edge-private-cloud-aio-docker-image.html

rushins
New Member

hi @RajeshMishra@Google: Can i have your email contact. I have some questions towards on this .

rajeshmi
Staff

rajeshmi@google.com

Version history
Last update:
‎08-17-2017 07:26 AM
Updated by: