Lab 2.3 - Deploy Hello-World Using ConfigMap w/ AS3

Just like the previous lab we’ll deploy the f5-hello-world docker container. But instead of using the Route resource we’ll use ConfigMap.

App Deployment

On okd-master1 we will create all the required files:

  1. Create a file called deployment-hello-world.yaml


    Use the file in ~/agilitydocs/docs/class2/openshift

     1apiVersion: apps/v1
     2kind: Deployment
     4  name: f5-hello-world-web
     5  namespace: default
     7  replicas: 2
     8  selector:
     9    matchLabels:
    10      app: f5-hello-world-web
    11  template:
    12    metadata:
    13      labels:
    14        app: f5-hello-world-web
    15    spec:
    16      containers:
    17      - env:
    18        - name: service_name
    19          value: f5-hello-world-web
    20        image: f5devcentral/f5-hello-world:develop
    21        imagePullPolicy: IfNotPresent
    22        name: f5-hello-world-web
    23        ports:
    24        - containerPort: 8080
    25          protocol: TCP
  2. Create a file called f5-hello-world-service-cluster.yaml


    Use the file in ~/agilitydocs/docs/class2/openshift

     1apiVersion: v1
     2kind: Service
     4  name: f5-hello-world-web
     5  namespace: default
     6  labels:
     7    app: f5-hello-world-web
     8 AS3
     9 A1
    10 web_pool
    12  ports:
    13  - name: f5-hello-world-web
    14    port: 8080
    15    protocol: TCP
    16    targetPort: 8080
    17  type: ClusterIP
    18  selector:
    19    app: f5-hello-world-web
  3. Create a file called configmap-hello-world.yaml


    Use the file in ~/agilitydocs/docs/class2/openshift

     1apiVersion: v1
     2kind: ConfigMap
     4  name: f5-as3-declaration
     5  namespace: default
     6  labels:
     7    f5type: virtual-server
     8    as3: "true"
    10  template: |
    11    {
    12        "class": "AS3",
    13        "declaration": {
    14            "class": "ADC",
    15            "schemaVersion": "3.10.0",
    16            "id": "urn:uuid:33045210-3ab8-4636-9b2a-c98d22ab915d",
    17            "label": "http",
    18            "remark": "A1 example",
    19            "AS3": {
    20                "class": "Tenant",
    21                "A1": {
    22                    "class": "Application",
    23                    "template": "http",
    24                    "serviceMain": {
    25                        "class": "Service_HTTP",
    26                        "virtualAddresses": [
    27                            ""
    28                        ],
    29                        "pool": "web_pool",
    30                        "virtualPort": 80
    31                    },
    32                    "web_pool": {
    33                        "class": "Pool",
    34                        "monitors": [
    35                            "http"
    36                        ],
    37                        "members": [
    38                            {
    39                                "servicePort": 8080,
    40                                "serverAddresses": []
    41                            }
    42                        ]
    43                    }
    44                }
    45            }
    46        }
    47    }
  4. We can now launch our application:

    oc create -f deployment-hello-world.yaml
    oc create -f clusterip-service-hello-world.yaml
    oc create -f configmap-hello-world.yaml
  5. To check the status of our deployment, you can run the following commands:

    oc get pods -o wide
    oc describe svc f5-hello-world


    To understand and test the new app pay attention to the Endpoints value, this shows our 2 instances (defined as replicas in our deployment file) and the overlay network IP assigned to the pod.

  6. Now that we have deployed our application sucessfully, we can check the configuration on BIG-IP1. Switch back to the open management session on firefox.


    Don’t forget to select the proper partition. Previously we checked the “okd” partition. In this case we need to look at the “AS3” partition. This partition was auto created by AS3 and named after the Tenant which happens to be “AS3”.

    Browse to: Local Traffic ‣ Virtual Servers

    Here you can see a new Virtual Server, “serviceMain” was created, listening on in partition “AS3”.

  7. Check the Pools to see a new pool and the associated pool members.

    Browse to: Local Traffic ‣ Pools and select the “web_pool” pool. Click the Members tab.



    You can see that the pool members IP addresses are assigned from the overlay network (ClusterIP mode)

  8. Access your web application via Firefox on the superjump.


    Select the “Hello, World” shortcut or type in the URL field.

  9. Hit Refresh many times and go back to your BIG-IP UI.

    Browse to: Local Traffic ‣ Pools ‣ Pool list ‣ “web_pool” ‣ Statistics to see that traffic is distributed as expected.



    Why is all the traffic directed to one pool member? The answer can be found by instpecting the “serviceMain” virtual service in the management GUI.

  10. Scale the f5-hello-world app

    oc scale --replicas=10 deployment/f5-hello-world-web -n default
  11. Check that the pods were created

    oc get pods
  12. Check the pool was updated on BIG-IP1. Browse to: Local Traffic ‣ Pools and select the “web_pool” pool. Click the Members tab.



    Now we show 10 pool members. In module1 the number stayed at 3 and didn’t change, why?

  13. Remove Hello-World from BIG-IP.


    In older versions of AS3 a “blank AS3 declaration” was required to completely remove the application/declaration from BIG-IP. In AS3 v2.20 and newer this is no longer a requirement.

    oc delete -f configmap-hello-world.yaml
    oc delete -f clusterip-service-hello-world.yaml
    oc delete -f deployment-hello-world.yaml


    Be sure to verify the virtual server and “AS3” partition were removed from BIG-IP.


This concludes Class 2 - CIS and OpenShift. Feel free to experiment with any of the settings. The lab will be destroyed at the end of the class/day.