OpenShift

CIS Installation

Prerequisites

These are the mandatory requirements for deploying CIS:

  • OpenShift Cluster must be up and running.

  • AS3: 3.18+ must be installed on your BIG-IP system.

  • Create a BIG-IP partition to manage OpenShift objects. This partition can be created either via the GUI (System > Users > Partition List) or via TMOS CLI:

    create auth partition <cis_managed_partition>
    
  • You need a user with administrative access to this partition.

  • If you need to pull the k8s-bigip-ctlr image from a private Docker registry, store your Docker login credentials as a Secret.

Additionally, if you are deploying CIS in Cluster Mode you need to have the following prerequisites. For more information, see Deployment Options.


Installing CIS Manually

  1. Add BIG-IP credentials as OSPC secrets.

    oc create secret generic bigip-login -n kube-system --from-literal=username=admin --from-literal=password=<password>
    
  2. Create a Service Account for deploying CIS. In the example below, the Service Account is named bigip-ctlr.

    oc create serviceaccount bigip-ctlr -n kube-system
    
  3. Create a Cluster Role and Cluster Role Binding on the Openshift Cluster using the examples below.

    The most up-to-date version of this example is here: f5-kctlr-openshift-clusterrole.yaml
     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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    # For use in OpenShift clusters
    apiVersion: v1
    kind: ClusterRole
    metadata:
      annotations:
        authorization.openshift.io/system-only: "true"
      name: system:bigip-ctlr
    rules:
    - apiGroups:
      - ""
      - "extensions"
      resources:
      - nodes
      - services
      - endpoints
      - namespaces
      - ingresses
      - routes
      - secrets
      verbs:
      - get
      - list
      - watch
    - apiGroups:
      - ""
      - "extensions"
      resources:
      - configmaps
      - events
      - ingresses/status
      verbs:
      - get
      - list
      - watch
      - update
      - create
      - patch
    
    ---
    
    apiVersion: v1
    kind: ClusterRoleBinding
    metadata:
        name: bigip-ctlr-role
    userNames:
    - system:serviceaccount:kube-system:bigip-ctlr
    subjects:
    - kind: ServiceAccount
      namespace: kube-system
      name: bigip-ctlr
    roleRef:
      name: system:bigip-ctlr
    

    f5-kctlr-openshift-clusterrole.yaml

    Push this configuration with the following command:

    oc apply -f openshift_rbac.yaml
    

    Important

    You can substitute a Role and RoleBinding if your Controller does not need access to the entire Cluster.


  1. [Optional] If you plan to use CIS in CRD mode, install CR definition. To install F5 CRDs, download this file and run the following command:

    oc create -f customresourcedefinitions.yml [-n kube-system]
    
  2. Create the Cluster admin privileges for the BIG-IP service account user with the following command:

    oc adm policy add-cluster-role-to-user cluster-admin -z bigip-ctlr -n kube-system
    
  3. Create a CIS deployment using cis_deploy.yaml as shown below:

    cis_deploy.yaml
     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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: k8s-bigip-ctlr-deployment
      namespace: kube-system
    spec:
    # DO NOT INCREASE REPLICA COUNT
      replicas: 1
      selector:
        matchLabels:
          app: k8s-bigip-ctlr-deployment
      template:
        metadata:
          labels:
            app: k8s-bigip-ctlr-deployment
        spec:
          # Name of the Service Account bound to a Cluster Role with the required
          # permissions
          containers:
            - name: k8s-bigip-ctlr
              image: "f5networks/k8s-bigip-ctlr:latest"
              env:
                - name: BIGIP_USERNAME
                  valueFrom:
                    secretKeyRef:
                    # Replace with the name of the Secret containing your login
                    # credentials
                      name: bigip-login
                      key: username
                - name: BIGIP_PASSWORD
                  valueFrom:
                    secretKeyRef:
                    # Replace with the name of the Secret containing your login
                    # credentials
                      name: bigip-login
                      key: password
              command: ["/app/bin/k8s-bigip-ctlr"]
              args: [
                # See the k8s-bigip-ctlr documentation for information about
                # all config options
                # https://clouddocs.f5.com/containers/latest/userguide/config-parameters.html
                "--bigip-username=$(BIGIP_USERNAME)",
                "--bigip-password=$(BIGIP_PASSWORD)",
                "--bigip-url=<ip_address-or-hostname>",
                "--bigip-partition=<name_of_partition>",
                "--pool-member-type=nodeport",
                "--insecure",
                ]
          serviceAccountName: bigip-ctlr
    

    cis_deploy.yaml

    Push this configuration with the following command:

    oc apply -f cis_deploy.yaml
    

Installing CIS using Operators on OpenShift Cluster

An Operator is a method of packaging, deploying, and managing a Kubernetes application. A Kubernetes application is an application that is both deployed on Kubernetes and managed using the Kubernetes APIs and kubectl/oc tooling. You can think of Operators as the runtime that manages this type of application on Kubernetes. Conceptually, an Operator takes human operational knowledge and encodes it into software that is more easily packaged and shared with consumers.

The F5 BIG-IP CIS (k8s-bigip-ctlr) is a cloud-native connector that can use either Kubernetes or OpenShift as a BIG-IP orchestration platform. F5 BIG-IP CIS Operator is a Service Operator which installs F5 BIG-IP CIS on OpenShift platforms 4.x.

Before you install CIS using Operators on OpenShift, you must create BIG-IP login credentials to use with Operator Helm Charts:

oc create secret generic <SECRET-NAME> -n kube-system
--from-literal=username=<USERNAME> --from-literal=password=<PASSWORD>
  1. Access the OCP web console: From CLI, login as admin using CRC given credentials. In the example below, the username is kubeadmin and the password is db9Dr-J2csc-8oP78-9sbmf.

    $ eval $(crc  oc-env)
    $ oc login -u kubeadmin -p db9Dr-J2csc-8oP78-9sbmf https://api.crc.testing:6443
    
  2. Within the OCP web console, in the left Menu bar, click Operator Hub and search for “f5” to see the Certified F5 BIG-IP CIS Operator.

    ../../_images/ocp-bigip-controller.jpeg
  3. Click Install to go through the guided installation process.

    ../../_images/create-operator-subscription.jpeg

    When Operator is Subscribed, Operator is installed based on approval strategy. The default approval strategy is Automatic.

    • Manual: Requires administrator approval to install new updates.
    • Automatic: When a new release is available, updated automatic.

Installing CIS Using Helm Charts

This is the simplest way to install CIS on an OpenShift cluster. Helm is a package manager for Kubernetes. Helm is Kubernetes version of YUM or APT. Helm deploys something called charts, which you can think of as a packaged application. It is a collection of all your versioned, pre-configured application resources which can be deployed as one unit.

  1. Add BIG-IP credentials as K8S secrets.

    For Openshift, use the following command:

    oc create secret generic f5-bigip-ctlr-login -n kube-system --from-literal=username=admin --from-literal=password=<password>
    
  2. Add the CIS chart repository in Helm using following command:

    helm repo add f5-stable https://f5networks.github.io/charts/stable
    
  3. Create values.yaml as shown below:

    values.yaml
     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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    # For additional information on installing the k8-bigip-ctlr please see:
    # Kubernetes: http://clouddocs.f5.com/containers/latest/kubernetes/kctlr-app-install.html
    # OpenShift: http://clouddocs.f5.com/containers/latest/openshift/kctlr-openshift-app-install.html#install-kctlr-openshift
    #
    # access / permissions / RBAC
    bigip_login_secret: f5-bigip-ctlr-login
    rbac:
      create: true
    serviceAccount:
      # Specifies whether a service account should be created
      create: true
      # The name of the service account to use.
      # If not set and create is true, a name is generated using the fullname template
      name:
    # This namespace is where the Controller lives;
    ingressClass:
      create: true
      ingressClassName: f5
      isDefaultIngressController: true
    namespace: kube-system
    args:
      # See http://clouddocs.f5.com/products/connectors/k8s-bigip-ctlr/latest/#controller-configuration-parameters
      # NOTE: helm has difficulty with values using `-`; `_` are used for naming
      # and are replaced with `-` during rendering.
      # REQUIRED Params
      bigip_url: ~
      bigip_partition: f5-bigip-ctlr
      # OPTIONAL PARAMS -- uncomment and provide values for those you wish to use.
      # verify_interval:
      # node-poll_interval:
      # log_level:
      # python_basedir: ~
      # VXLAN
      # openshift_sdn_name:
      # flannel_name:
      # KUBERNETES
      # default_ingress_ip:
      # kubeconfig:
      # namespaces: ["foo", "bar"]
      # namespace_label:
      # node_label_selector:
      # pool_member_type:
      # resolve_ingress_names:
      # running_in_cluster:
      # use_node_internal:
      # use_secrets:
      # insecure: true
      # custom-resource-mode: true
      # log-as3-response: true
      # gtm-bigip-password
      # gtm-bigip-url
      # gtm-bigip-username
      # ipam : true
    
    image:
      # Use the tag to target a specific version of the Controller
      user: f5networks
      repo: k8s-bigip-ctlr
      pullPolicy: Always
    #  version: latest
    # affinity:
    #   nodeAffinity:
    #     requiredDuringSchedulingIgnoredDuringExecution:
    #       nodeSelectorTerms:
    #       - matchExpressions:
    #         - key: kubernetes.io/arch
    #           operator: Exists
    # securityContext:
    #   runAsUser: 1000
    #   runAsGroup: 3000
    #   fsGroup: 2000
    # If you want to specify resources, uncomment the following
    # limits_cpu: 100m
    # limits_memory: 512Mi
    # requests_cpu: 100m
    # requests_memory: 512Mi
    

  1. Install the Helm chart using the following command:

    helm install -f values.yaml <new-chart> f5-stable/f5-bigip-ctlr
    

    Note

    For Kubernetes versions lower than 1.18, please use Helm chart version 0.0.14 as follows: helm install --skip-crds -f values.yaml <new-chart-name> f5-stable/f5-bigip-ctlr --version 0.0.14.


Chart parameters

Parameter Required Default Description
bigip_login_secret Required f5-bigip-ctlr-login Secret that contains BIG-IP login credentials.
args.bigip_url Required N/A The management IP for your BIG-IP device.
args.bigip_partition Required f5-bigip-ctlr BIG-IP partition the CIS Controller will manage.
args.namespaces Optional N/A List of Kubernetes namespaces which CIS will monitor.
rbac.create Optional true Create ClusterRole and ClusterRoleBinding.
serviceAccount.name Optional f5-bigip-ctlr- serviceaccount Name of the ServiceAccount for CIS controller.
serviceAccount.create Optional true Create service account for the CIS controller.
namespace Optional kube-system Name of namespace CIS will use to create deployment and other resources.
image.user Optional f5networks CIS Controller image repository username.
image.repo Optional k8s-bigip-ctlr CIS Controller image repository name.
image.pullPolicy Optional Always CIS Controller image pull policy.
image.pullSecrets Optional N/A List of secrets of container registry to pull image.
version Optional latest CIS Controller image tag.
nodeSelector Optional N/A Dictionary of Node selector labels.
tolerations Optional N/A Array of labels.
limits_cpu Optional 100m CPU limits for the pod.
limits_memory Optional 512Mi Memory limits for the pod.
requests_cpu Optional 100m CPU request for the pod.
requests_memory Optional 512Mi Memory request for the pod.
affinity Optional N/A Dictionary of affinity.
securityContext Optional N/A Dictionary of securityContext.
ingressClass.ingressClassName Optional f5 Name of ingress class.
ingressClass.isDefaultIngressController Optional false CIS will monitor all the ingress resources if set true.
ingressClass.create Optional true Create ingress class.

Uninstalling Helm Chart

Run the following command to uninstall the chart.

helm uninstall <new-chart>

Creating VXLAN Tunnels on Openshift Cluster

This section is only required if you plan to use CIS in a ClusterIP Deployment. See ClusterIP for more information.

  1. Log in to the BIG-IP and create a BIG-IP partition.

    tmsh create auth partition <partition_name>
    
  2. Create a VXLAN tunnel. In the example below, the tunnel name is fl-vxlan.

    tmsh create net tunnels vxlan fl-vxlan port 8472 flooding-type none
    
    ../../_images/openshift-vxlan-1.png
  3. Create a VXLAN profile with an internal self IP.

    tmsh create net tunnels tunnel fl-vxlan key 1 profile fl-vxlan local-address 192.168.200.91
    
    ../../_images/openshift-vxlan-2.png
  4. Create the VXLAN tunnel self IP.

    tmsh create net self 10.244.20.91 address 10.244.20.91/255.255.0.0 allow-service none vlan fl-vxlan
    
    ../../_images/openshift-vxlan-3.png

Examples Repository

View more examples on GitHub.


OpenShift Route Resources

Note

You can use OpenShift Route resources in an existing deployment once you replace the OpenShift F5 Router with the BIG-IP Controller.

Supported Route Configurations

Important

The CIS supports a single path-based route for TLS re-encryption. Multiple path-based routes are not currently supported.

Type Client Connection Encrypted Server Connection Encrypted Path Support SSL Termination on BIG-IP Description
Unsecured No No Yes No The BIG-IP system forwards unsecured traffic from the client to the endpoint.
Edge Terminated Yes No Yes Yes

The Controller maintains a new client SSL profile on the BIG-IP system based on the client certificate and key from the Route resource.

  • Set insecureEdgeTerminationPolicy in the Route resource to Allow to enable support for insecure client connections.
  • Set insecureEdgeTerminationPolicy in the Route resource to Redirect to redirect HTTP client connections to the HTTPS endpoint.
Passthrough Terminated Yes Yes No No The BIG-IP system uses an iRule to select the destination pool based on SNI and forward the re-encrypted traffic.
Re-encrypt Terminated Yes Yes Yes Yes

The Controller maintains a new BIG-IP client SSL profile based on the client certificate and key from the Route resource.

The Controller maintains a new BIG-IP server SSL profile based on the server CA certificate from the Route resource for re-encrypting the traffic.

The BIG-IP system uses an iRule to select the destination pool based on SNI and forward the re-encrypted traffic.

Supported Route Annotations

Annotation Type Required Description Default Allowed Values
virtual-server.f5.com/balance string Optional Sets the load balancing mode. round-robin Any supported load balancing algorithm
virtual-server.f5.com/clientssl string Optional The name of a pre-configured client ssl profile on the BIG-IP system. The controller uses this profile instead of the certificate and key within the Route’s configuration. N/A  
virtual-server.f5.com/serverssl string Optional The name of a pre-configured server ssl profile on the BIG-IP system. The controller uses this profile instead of the certificate within the Route’s configuration. N/A  
virtual-server.f5.com/health JSON object Optional Defines a health monitor for the Route resource. N/A  
  path string Required The path for the Service specified in the Route resource. N/A  
  interval integer Required The interval at which to check the health of the virtual server. N/A  
  timeout integer Required Number of seconds before the check times out. N/A  
  send string Required The send string to set in the health monitor. N/A  
  recv string Optional String or RegEx pattern to match in first 5,120 bytes of backend response. N/A  
  type string Optional Specify the type (http or https) of Health monitor. N/A  
virtual-server.f5.com/secure-serverssl boolean Optional Specify to validate the server-side SSL certificate of re-encrypt terminated routes. false “true”, “false”
virtual-server.f5.com/rewrite-app-root string Optional Root path redirection for the application. N/A  
virtual-server.f5.com/rewrite-target-url string Optional URL host, path, or host and path to be rewritten. N/A  
virtual-server.f5.com/allow-source-range string Optional Comma-separated list of CIDR addresses to allow inbound to Route services. N/A

Comma-separated, CIDR formatted, IP addresses.

ex. 1.2.3.4/32,2.2.2.0/24

virtual-server.f5.com/waf string Optional The name of a pre-configured WAF Policy on the BIG-IP system. N/A  

Important

For edge (client) termination, a Route must include either the certificate/key literal information in the Route Spec, or the clientssl annotation. For re-encrypt (server) termination, a Route must include either the destinationCaCertificate literal information in the Route Spec, or the serverssl annotation, in addition to the edge rules listed previously. If you want to use the configuration parameters default-clientssl or default-serverssl profiles for a Route, then specify those profile names in the Route annotations in addition to the controller configuration.


Note

To provide feedback on Container Ingress Services or this documentation, please file a GitHub Issue.