vK8s Deployment

Objective

This document provides instructions on how to deploy applications with F5® Distributed Cloud Services using virtual Kubernetes (vK8s). Distributed Cloud Services provide a mechanism to easily deploy applications across a global network and make them available closer to users in major metro markets. To learn more about how Distributed Cloud Services distribute application deployment, see Distributed Application Management.

To deploy applications on your sites, first create a vK8s object per the instructions in the Create Virtual K8s Object document.

Using the instructions provided in this guide, you can deploy applications on your sites with the kubeconfig file of the vK8s object.


Prerequisites


Restrictions

The following restrictions apply for deploying applications with Distributed Cloud Services:

  • Running of containers/pods with host networking hostNetwork, host PID hostPID, or host IPC hostIPC is not supported.

  • Running containers/pods as privileged is not supported.

  • Running containers/pods as root user is not supported. The container images are required to support running under arbitrary user ID and group ID. Filesystem write permissions should not be specified to a particular user ID. Else, the container will crash with the permission denied message.

  • Container/pod can only use ports higher than 1024.

  • The containers are not supported for use with host mount volumes. The following Kubernetes volumes are supported:

    • configMap

    • DownwardAPI

    • emptyDir

    • PersistentVolumeClaim (PVC)

    • projected

    • secret

  • During maintenance or reboot of the site, the vK8s pods are replaced with new pods and new names in order to obtain fresh identities for pods.


Configuration

Configuration Sequence

Deploying applications with Distributed Cloud Services requires you to perform the following sequence of steps:

PhaseDescription
Deploy Applications to vK8sAdd applications deployments to the created vK8s object.
Verify the Application Deployment StatusCheck the application deployment status and site status.

Deploy Applications to vK8s

Deploy Kubernetes objects to vK8s after virtual sites are chosen. Any object created through this vK8s gets reflected on all sites which are part of the virtual site.

You can deploy applications via two methods:

  • F5® Distributed Cloud Console (Console)

  • Terminal using the kubectl tool (by obtaining a kubeconfig file from Console)

Note: You can use specific annotations to select the sites where the Kubernetes application needs to be deployed. These annotations can be provided alongside other configurations in the Kubernetes deployment manifest. For more information on annotations, see Resource Management for Distributed Cloud Services vK8s.

          "annotations": {
      "ves.io/virtual-sites": "demo-volterra/demo-vK8s-network-cloud"
    }
        

This document covers adding a Kubernetes deployment using the terminal.

Step 1: Navigate to your vK8s object.
  • From the Console Homepage, select Distributed Apps.
Figure: Homepage
Figure: Homepage
  • Select the desired namespace from the Namespace drop-down menu.

  • Navigate to Applications > Virtual K8s.

  • Select ... > Kubeconfig for the created vK8s object to download its kubeconfig file.

Figure: Kubeconfig File
Kubeconfig File
Step 2: Deploy the web application.

To deploy the web application in a K8s cluster, the following items are required:

  • Kubeconfig file of the K8s cluster. For this, use the vK8s kubeconfig file downloaded in the previous step.

  • Manifest file of your web application. Download the sample manifest this example uses and edit its fields per your application.

Note: The following information applies:

  • Contents of the application manifest file that are incompatible with the standard K8s schema are not supported.

  • Rate limiting is applied for images hosted on Docker Hub. Ensure that you specify your Docker credentials in the manifest file to increase your image pull rate limits. See Docker Hub Rate Limiting for more information.

  • You can use an external container registry or create a container registry object using Console for your images. See Container Registry guide to create a container registry object in Console and use it in vK8s workloads. Alternatively, you can use your secret using the imagePullSecret field inside the manifest file and deploy applications. See K8s Documentation for more information.

To deploy the application, type kubectl apply -f <manifest file here>.yaml --kubeconfig <Kubeconfig file here>.yaml.

This completes the deployment of the application across all sites selected by the virtual site associated with your vK8s object.

Step 3: Verify pod creation status.

To verify, type kubectl get pods --kubeconfig <Kubeconfig file here>.yaml.

          kubectl get pods --kubeconfig <Kubeconfig file here>.yaml
        
          NAME                                     READY   STATUS    RESTARTS   AGE
cartservice-7dc68df6db-z77h6             2/2     Running   15         13h
cartservice-847c7b5fb7-kt7nt             2/2     Running   1205       4d18h
cartservice-f479bcf99-626pc              2/2     Running   0          13h
checkoutservice-5565f4b945-79p6l         2/2     Running   0          13h
checkoutservice-66b55f768b-4tnz2         2/2     Running   0          13h
checkoutservice-68b8b49ff8-ds6br         2/2     Running   0          4d18h
currencyservice-6967b6b6d9-cbz8h         2/2     Running   0          10d
currencyservice-976b7969b-ndkbv          2/2     Running   0          13h
currencyservice-d87c46889-q7gdg          2/2     Running   0          13h
emailservice-55b46c6d6b-dxngg            2/2     Running   0          4d18h
emailservice-c5566464c-hhmxb             2/2     Running   0          13h
emailservice-d886bb6f8-xgj64             2/2     Running   0          13h
frontend-6ff5b6764-f2jp2                 2/2     Running   0          13h
frontend-8fd97cd6c-z7lzt                 2/2     Running   0          13h
frontend-bbf4fd775-8wvbz                 2/2     Running   0          10d
loadgenerator-67d7649fd5-xx2bz           2/2     Running   0          13h
loadgenerator-86596bff7d-dzrjh           2/2     Running   0          13h
loadgenerator-d96dd88c8-tm9k2            2/2     Running   0          10d
paymentservice-5598cf5dd-8prlm           2/2     Running   0          10d
paymentservice-5c4f4458df-b4fpg          2/2     Running   0          13h
paymentservice-7579f47d44-xqnd6          2/2     Running   0          13h
productcatalogservice-5c8c679f6f-g25hm   2/2     Running   2          13h
productcatalogservice-7bf45c88bd-8t2p2   2/2     Running   0          13h
productcatalogservice-fc7f9bcf6-7jsbq    2/2     Running   0          10d
recommendationservice-5c6b6b494c-5jjxf   2/2     Running   0          4d18h
recommendationservice-687849c8b-ljkmh    2/2     Running   0          13h
recommendationservice-94867fb55-fn4lg    2/2     Running   0          13h
redis-cart-6dd5596479-99d5c              2/2     Running   0          13h
redis-cart-79988f9fd4-d6rnt              2/2     Running   0          13h
redis-cart-d778ddf99-xjqm7               2/2     Running   0          10d
shippingservice-5f94f76df7-wbg86         2/2     Running   0          13h
shippingservice-6f578dbdf6-2gz4k         2/2     Running   0          13h
shippingservice-7fc4f5b6c6-pqblb         2/2     Running   0          4d18h
        

Note: Pods created on a site via Deployment, StatefulSet, Job, and CronJob in vK8s are configured with the site labels as environment variables. If the labels are changed on a site, the pods are restarted with the changed labels set as environment variables.


Verify the Application Deployment Status

After the deployment is created, Console enables you to check the status of the deployed application.

Step 1: View status of deployment.

As seen in the below example, the application speedtest-ce is healthy and deployed on the virtual site shared/all-ces, which maps to network cloud sites.

Figure: vK8s Deployment Status
Figure: vK8s Deployment Status
Step 2: Select to view per-pod.

Select the Pods tab to get a per-pod view.

vK8s Pod Status
Figure: vK8s Pod Status
Step 3: View application/deployment resource metrics.

Select Applications > Virtual Sites.

Network Cloud Virtual Site Status
Figure: Network Cloud Virtual Site Status

After the application is deployed using vK8s, you can use it with other configuration objects from Distributed Cloud Services. For example, you can advertise the application across the public network.


Concepts


API References