Skip to content

Commit fb1e792

Browse files
committed
first pass conversion complete
1 parent 35b416f commit fb1e792

25 files changed

+1767
-1653
lines changed

cnf-best-practices.adoc

Lines changed: 24 additions & 1653 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[id="cnf-best-practices-block-storage"]
2+
= Block Storage
3+
4+
OpenShift Container Platform can provision raw block volumes. These volumes do not have a file system, and can provide performance benefits for applications that either write to the disk directly or implement their own storage service.
5+
6+
There are 2 types of storage connectivity and 2 levels of storage in each. All block storage is located on a NetApp appliance.
7+
8+
The two types of storage connectivity are:
9+
10+
NFS:: This is the default storage type
11+
12+
iSCSI:: This type of storage should ONLY be used if needed by database type applications
13+
14+
More info on Block Volume storage support here:
15+
16+
link:https://docs.openshift.com/container-platform/4.4/storage/understanding-persistent-storage.html#block-volume-support_understanding-persistent-storage[]
17+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[id="cnf-best-practices-ci-cd"]
2+
= CI/CD Framework
3+
4+
Applications should target a CI/CD approach for deployment and validation.
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[id="cnf-best-practices-cni-ovn"]
2+
= CNI-OVN
3+
4+
OVN is the default pod network CNI plugin for OpenShift and is supported directly by Red Hat. OVN is Red Hat's CNI for pods. It is a Geneve based overlay that requires L3 reachability between the host nodes. This L3 reachability can be over L2 or a pre-existing overlay network. OpenShift's OVN forwarding is based on flow rules and implemented with nftables on the host OS CNI POD.
5+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[id="cnf-best-practices-container-runtime"]
2+
= Container Runtime
3+
4+
OpenShift uses CRI-O as a CRI interface for Kubernetes. CRI-O manages runC for container image execution. CRI-O is an open-source container engine that provides a stable, performant platform for running OCI compatible runtimes. CRI-O is developed, tested and released in tandem with Kubernetes major and minor releases. Images should be OCI compliant. Images are recommended to be built using Red Hat's open Universal Base Image. See later sections for additional information on UBI and support.
5+
6+
Red Hat Documentation on CRI-O and Read Only Containers
7+
8+
link:https://blog.openshift.com/add-a-layer-of-security-to-openshift-kubernetes-with-cri-o-in-read-only-mode/[]
9+
10+
link:https://github.com/cri-o/cri-o/blob/master/docs/crio.8.md[]
11+
12+
This environment is maintained through the open source tools:
13+
14+
* runc
15+
* skopeo
16+
* buildah
17+
* podman
18+
* crio
19+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[id="cnf-best-practices-cpu-manager-pinning"]
2+
= CPU Manager/Pinning
3+
4+
The OpenShift platform can use the Kubernetes CPU Manager to support CPU pinning for applications.
5+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[id="cnf-best-practices-csi"]
2+
= Container Storage (CSI)
3+
4+
Pod Volumes are supported via local storage and the CSI for persistent volumes. Local storage is truly ephemeral storage, it is local only to the physical node that a pod is running on and will be lost in the event a pod is killed and recreated. If a Pod requires persistent storage the CSI can be used via kubernetes native primitives persistentVolume (PV) and persistentVolumeClaim (PVC) to
5+
6+
get persistent storage, such as an NFS share via the CSI backed by NetApp Trident.
7+
8+
When using storage with Kubernetes, one can leverage storage classes. Please refer to the Block Storage section 3.3.5 for a description of the available storage classes. Volumes can then be requested based on the parameters of the storage they wish to use.
9+
10+
Network Functions should clear persistent storage by deleting their PVs when removing their application from a cluster.
11+
12+
Red Hat Persistent Storage Documentation:: link:https://docs.openshift.com/container-platform/4.4/storage/container_storage_interface/persistent-storage-csi.html[]
13+
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[id="cnf-best-practices-developer-guide"]
2+
= CNF Developer Guide
3+
4+
This section discusses recommendations and requirements for CNF application builders.
5+
6+
== Preface
7+
8+
Cloud-native Network Functions (CNFs) are containerized instances of classic physical or virtual network functions (VNF) which have been decomposed into microservices supporting elasticity, lifecycle management, security, logging, and other capabilities in a Cloud-Native format.
9+
10+
== Goal
11+
12+
This document is mainly for the developers of CNFs, who need to build high-performance Network Functions in a containerized environment. We have created a guide that any partner can take and follow when developing their CNFs so that they can be deployed on the OpenShift Container Platform (OCP) in a secure, efficient and supportable way.
13+
14+
== Non-Goal
15+
16+
This is not a guide on how to build CNF’s functionality.
17+
18+
=== Refactoring
19+
20+
NFs should break their software down into the smallest set of microservices as possible. Running monolithic applications inside of a container is not the operating model to be in.
21+
22+
It is hard to move a 1000LB boulder. However, it is easy when that boulder is broken down into many pieces (pebbles). All containerized network functions (CNFs) should break apart each piece of the functions/services/processes into separate containers. These containers will still be within kubernetes pods and all of the functions that perform a single task should be within the same namespace.
23+
24+
There is a quote that describes this best from link:Lewis and Fowler:# "the microservice architectural []style is an approach to developing a single application as a suite of small services, eachrunning in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. "
25+
26+
=== CNF Security
27+
28+
In OCP, it is possible to run privileged containers that have all of the root capabilities on a host machine, allowing the ability to access resources which are not accessible in ordinary containers. This, however, increases the security risk to the whole cluster. Containers should only request those privileges they need to run their legitimate functions. No containers will be allowed to run with full privileges without an exception.
29+
30+
The general guidelines are:
31+
32+
. Only ask for the necessary privileges and access control settings for your application. 2. If the function required by your CNF can be fulfilled by OCP components, your application should not be requesting escalated privilege to perform this function.
33+
34+
. Avoid using any host system resource if possible.
35+
36+
. Leveraging read only root filesystem when possible.
37+
38+
.CNF Requirement
39+
[IMPORTANT]
40+
====
41+
Only ask for the necessary privileges and access control settings for your application
42+
====
43+
44+
.CNF Requirement
45+
[IMPORTANT]
46+
====
47+
If the function required by your CNF can be fulfilled by OCP components, your application should not be
48+
requesting escalated privilege to perform this function.
49+
====
50+
51+
.CNF Requirement
52+
[IMPORTANT]
53+
====
54+
*Avoid* using any host system resource
55+
====
56+
57+
.CNF Requirement
58+
[IMPORTANT]
59+
====
60+
*Do not* mount host directories for device access
61+
====
62+
63+
.CNF Requirement
64+
[IMPORTANT]
65+
====
66+
*Do not* use host network namespace
67+
====
68+
69+
.CNF Requirement
70+
[IMPORTANT]
71+
====
72+
CNFs may *not* modify the platform in any way
73+
====
74+
75+
==== Avoid Accessing Resource on Host
76+
77+
It is not recommended for an application to access following resources on the host.
78+
79+
==== Avoid Mounting host directories as volumes
80+
81+
It is not necessary to mount host /sys/ or host /dev/ directory as a volume in a pod in order to use a network device such as SR-IOV VF. The moving of a network interface into the pod network namespace is done automatically by CNI. Mounting the whole /sys/ or /dev/ directory in the container will overwrite the network device descriptor inside the container which causes 'device not found' or 'no such file or directory' error.
82+
83+
Network interface statistics can be queried inside the container using the same /sys/ path as was done when running directly on the host. When running network interfaces in containers, relevant /sys/ statistics interfaces are available inside the container, such as '/sys/class/net/net1/statistics/', '/proc/net/tcp' and '/proc/net/tcp6'.
84+
85+
For running DPDK applications with SR-IOV VF, device specs (in case of vfio-pci) are automatically attached to the container via the Device Plugin. There is no need to mount the /dev/ directory as a volume in the container as the application can find device specs under '/dev/vfio/' in the container.
86+
87+
==== Avoid the host network namespace
88+
89+
Application pods must avoid using hostNetwork. Applications may not use the host network, including nodePort for network communication. Any networking needs beyond the functions provided by the pod network and ingress/egress proxy must be serviced via a MULTUS connected interface.
90+
91+
.CNF Requirement
92+
[IMPORTANT]
93+
====
94+
Applications may *not* use NodePorts or the hostNetwork
95+
====
96+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[id="cnf-best-practices-ephemeral-storage"]
2+
= Ephemeral Storage
3+
4+
Pods and containers can require ephemeral or transient local storage for their operation. The lifetime of this ephemeral storage does not extend beyond the life of the individual pod, and this ephemeral storage cannot be shared across pods.
5+
6+
.CNF Requirement
7+
[IMPORTANT]
8+
====
9+
PODs must *NOT* place persistent data into ephemeral storage
10+
====
11+

0 commit comments

Comments
 (0)