Lab 1.4 - F5 Container Connector Usage

Now that our container connector is up and running, let’s deploy an application to test both route domans / partitions.

For this lab we’ll use a simple pre-configured docker image called “f5-hello-world”. It can be found on docker hub at f5devcentral/f5-hello-world

To deploy “f5-hello-world” on ose-master1 and ose-master2 create the following files:

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

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: f5-hello-world
    spec:
      replicas: 2
      template:
        metadata:
          labels:
            run: f5-hello-world
        spec:
          containers:
          - name: f5-hello-world
            image: "f5devcentral/f5-hello-world:develop"
            imagePullPolicy: IfNotPresent
            ports:
            - containerPort: 8080
              protocol: TCP
    
  2. Create a file called f5-hello-world-service.yaml

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    apiVersion: v1
    kind: Service
    metadata:
      name: f5-hello-world
      labels:
        run: f5-hello-world
    spec:
      ports:
      - port: 8080
        protocol: TCP
        targetPort: 8080
      type: ClusterIP
      selector:
        run: f5-hello-world
    

Now we need to creat the f5 configmap of the application for each partition.

  1. Create a file called f5-hello-world-configmap-10.yaml on ose-master1

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: f5-hello-world
      namespace: default
      labels:
        f5type: virtual-server
    data:
      schema: "f5schemadb://bigip-virtual-server_v0.1.7.json"
      data: |
        {
          "virtualServer": {
            "frontend": {
              "balance": "round-robin",
              "mode": "http",
              "partition": "okd10",
              "virtualAddress": {
                "bindAddr": "10.1.10.80%0",
                "port": 80
              }
            },
            "backend": {
              "serviceName": "f5-hello-world",
              "servicePort": 8080,
              "healthMonitors": [{
                "interval": 5,
                "protocol": "http",
                "send": "HEAD / HTTP/1.0\r\n\r\n",
                "timeout": 16
              }]
            }
          }
        }
    
  2. Create a file called f5-hello-world-configmap-20.yaml on ose-master2

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: f5-hello-world
      namespace: default
      labels:
        f5type: virtual-server
    data:
      schema: "f5schemadb://bigip-virtual-server_v0.1.7.json"
      data: |
        {
          "virtualServer": {
            "frontend": {
              "balance": "round-robin",
              "mode": "http",
              "partition": "okd20",
              "virtualAddress": {
                "bindAddr": "10.1.10.81%0",
                "port": 80
              }
            },
            "backend": {
              "serviceName": "f5-hello-world",
              "servicePort": 8080,
              "healthMonitors": [{
                "interval": 5,
                "protocol": "http",
                "send": "HEAD / HTTP/1.0\r\n\r\n",
                "timeout": 16
              }]
            }
          }
        }
    
  3. We can now launch our application:

    ose-master1

    oc create -f f5-hello-world-deployment.yaml
    oc create -f f5-hello-world-service.yaml
    oc create -f f5-hello-world-configmap-10.yaml
    

    ose-master2

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

    oc get pods -o wide
    oc describe svc f5-hello-world
    
  5. To test the app you need to pay attention to connect to the jumphost, open browser and got http://10.1.10.80 and http://10.1.10.81