Note:

Use Cilium to Provide Networking Services in Oracle Cloud Infrastructure Container Engine for Kubernetes

Introduction

When we deploy a new Kubernetes cluster using Oracle Cloud Infrastructure Container Engine for Kubernetes (OKE), the default Container Network Interface (CNI) plugin installed is the OCI VCN-Native CNI plugin. With cloud native computing you are flexible to choose your method of providing network (security) services to your container platform by just choosing another CNI plugin. In this tutorial, we are going to deploy a new Kubernetes cluster using OKE with the Flannel CNI plugin and change this to Cilium CNI plugin. Cilium offers other network (security) features compared to the OCI VCN-Native CNI plugin and Flannel.

image

image

Objectives

Task 1: Deploy a Kubernetes Cluster using OKE

For more information about the different OKE deployment models, see Example Network Resource Configurations.

The example OKE deployment models are:

For this tutorial, we will select Example 1 deployment model. We have already explained how to deploy Example 3 here: Create a New Kubernetes Cluster and Verify the Components.

Task 2: Install Cilium as a CNI Plugin on the OKE deployed Kubernetes Cluster

Task 3: Deploy a Sample Web Application and Service

Task 4: Configure Kubernetes Services of NetworkPolicy Type

One of the network security services that the Cilium CNI plugin offers is the service of the NetworkPolicy type. This is a way of controlling the connectivity between pods by denying connectivity between two pods.

Task 5: Remove the Sample Web Application and Service

Task 6: Deploy a Sample Application and Configure Kubernetes Services of LoadBalancer Type

We have tested the NetworkPolicy service using Cilium, let us also test the LoadBalancer service using Cilium.

Task 7: Remove a Sample Application and Kubernetes Services of LoadBalancer Type

  1. Run the following command to get the pods that are deployed.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl get pods
    NAME                                READY   STATUS    RESTARTS   AGE
    nginx-deployment-86dcfdf4c6-6ncvx   1/1     Running   0          2m54s
    nginx-deployment-86dcfdf4c6-qbhn2   1/1     Running   0          2m54s
    
  2. Review the deployed pods.

  3. To remove the deployed web application, run the following command.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl delete deployment nginx-deployment --namespace default
    deployment.apps "nginx-deployment" deleted
    
  4. Confirm that the application is deleted.

  5. Run the following command to get the pods that are deployed.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl get pods
    No resources found in default namespace.
    
  6. Notice that the pods are no longer deployed and successfully deleted.

  7. Run the following command to get the services that are deployed.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl get svc
    NAME         TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)             AGE
    kubernetes   ClusterIP      10.96.0.1     <none>          443/TCP,12250/TCP   46h
    my-service   LoadBalancer   10.96.56.91   XXX.XXX.XXX.88   80:32422/TCP        2m42s
    
  8. Review the deployed services.

  9. To remove the deployed LoadBalancer services, run the following command.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl delete service my-service -n default
    service "my-service" deleted
    
  10. Verify that the service is deleted.

  11. Run the following command to get the services that are deployed.

    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ kubectl get svc
    NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)             AGE
    kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP,12250/TCP   46h
    iwan_hooge@cloudshell:~ (eu-amsterdam-1)$ 
    
  12. Notice that the LoadBalancer service is no longer deployed and successfully deleted.

image

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.