Network security
You can use network policies to control which connections are allowed or rejected.
Network policies
If the network isolation mode for the OpenShift® cluster is set to
NetworkPolicy (the default), you can control the flow of traffic between different
projects (namespaces). To define the flow, use the NetworkPolicy custom
resource.
To learn more about network policies, see About network policy in the Red Hat® OpenShift Container Platform documentation:
By default, all pods in a project are accessible from other pods and network endpoints. To
isolate one or more pods in a project, you can create NetworkPolicy objects in that
project to indicate the allowed incoming connections.
Network policies are cumulative, so you can combine multiple network policies to satisfy complex network requirements.
Network policies for the Certificate manager
Run the following command to see the network policies that are applied to the project where the IBM Cloud Pak foundational services Certificate manager is installed:
oc get networkpolicy \
--namespace=${PROJECT_CERT_MANAGER}
deny-by-defaultallow-from-same-namespaceallow-same-namespace
If any of the preceding network policies are applied to the project, create the following network policies for the Certificate manager:
- Allow access from Operator Lifecycle Manager
-
The following network policy is applied to all of the pods in the Certificate manager project. The network policy allows the pods in the Certificate manager project to accept incoming communication from pods in the Operator Lifecycle Manager project.
cat <<EOF |oc apply -f - kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: allow-from-openshift-operator-lifecycle-manager namespace: ${PROJECT_CERT_MANAGER} spec: podSelector: {} ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: openshift-operator-lifecycle-manager policyTypes: - Ingress EOF - Allow access from the API server
-
The following network policy is applied to all of the pods in the Certificate manager project. The network policy allows the pods in the Certificate manager project to accept incoming communication from the Red Hat OpenShift Container Platform API server.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: labels: component: cpfs3 name: allow-webhook-access-from-apiserver namespace: ${PROJECT_CERT_MANAGER} spec: ingress: - from: - namespaceSelector: {} podSelector: matchLabels: apiserver: "true" podSelector: {} policyTypes: - Ingress EOF - Allow access from the Certificate manager webhook
-
The following network policy is applied to all of the pods in the Certificate manager project. The network policy allows the pods in the Certificate manager project to accept incoming communication from the Certificate manager webhook.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: access-to-cert-manager-webhook namespace: ${PROJECT_CERT_MANAGER} labels: component: cpfs3 spec: podSelector: matchLabels: app: ibm-cert-manager-webhook ingress: - {} EOF
Network policies for the License Service
Run the following command to see the network policies that are applied to the project where the IBM Cloud Pak foundational services License Service is installed:
oc get networkpolicy \
--namespace=${PROJECT_LICENSE_SERVICE}
deny-by-defaultallow-from-same-namespaceallow-same-namespace
If any of the preceding network policies are applied to the project, create the following network policies for the License Service:
- Allow access from Operator Lifecycle Manager
-
The following network policy is applied to all of the pods in the License Service project. The network policy allows the pods in the License Service project to accept incoming communication from pods in the Operator Lifecycle Manager project.
cat <<EOF |oc apply -f - kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: allow-from-openshift-operator-lifecyele-manager namespace: ${PROJECT_LICENSE_SERVICE} spec: podSelector: {} ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: openshift-operator-lifecycle-manager policyTypes: - Ingress EOF - Allow access to usage reports
-
The following network policy is applied to the
ibm-license-service-reporter-instancepods in the License Service project. The network policy allows the pods to respond to requests to download usage reports.cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: access-to-ibm-licensing-service-reporter namespace: ${PROJECT_LICENSE_SERVICE} labels: component: cpfs3 spec: podSelector: matchLabels: app: ibm-license-service-reporter-instance ingress: - {} policyTypes: - Ingress EOF - Allow usage metric submissions
-
The following network policy is applied to the
ibm-licensing-service-instancepods in the License Service project. The network policy allows the pods to accept usage metrics.cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: access-to-ibm-licensing-service-instance namespace: ${PROJECT_LICENSE_SERVICE} labels: component: cpfs3 spec: podSelector: matchLabels: app: ibm-licensing-service-instance ingress: - {} policyTypes: - Ingress EOF
Network policies for the scheduling service
- Allow access to and from cluster resources
-
The following network policy is applied to all of the pods in the scheduling service project.
- Outgoing communication
-
The network policy denies all outgoing traffic project from the scheduling service project except:
- Requests to the Red Hat OpenShift Container Platform API server
- Query the Red Hat OpenShift Container Platform DNS service
- Incoming communication
-
The network policy denies all incoming traffic to the scheduling service project except:
- Incoming communication from the Red Hat OpenShift Container Platform API server
- Incoming communication from Prometheus
- Incoming communication from pods in the Operator Lifecycle Manager project
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: common namespace: ${PROJECT_SCHEDULING_SERVICE} labels: icpdsupport/addOnId: scheduling icpdsupport/ignore-on-nd-backup: "true" velero.io/exclude-from-backup: "true" spec: egress: - to: - namespaceSelector: {} podSelector: matchLabels: apiserver: "true" - to: - podSelector: {} namespaceSelector: matchLabels: kubernetes.io/metadata.name: openshift-dns ingress: - from: - podSelector: {} namespaceSelector: matchLabels: openshift.io/cluster-monitoring: "true" - from: - podSelector: {} namespaceSelector: matchLabels: kubernetes.io/metadata.name: openshift-operator-lifecycle-manager - from: - namespaceSelector: {} podSelector: matchLabels: apiserver: "true" podSelector: {} policyTypes: - Egress - Ingress EOF - Allow access from the scheduling service webhook
-
The following network policy is applied to all of the pods in the scheduling service project. The network policy allows the pods in the scheduling service project to accept incoming communication from the scheduling service webhook.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: webhook namespace: ${PROJECT_SCHEDULING_SERVICE} labels: icpdsupport/addOnId: scheduling icpdsupport/ignore-on-nd-backup: "true" velero.io/exclude-from-backup: "true" spec: podSelector: matchLabels: netpol: webhook ingress: - {} policyTypes: - Ingress EOF - Allow access to the Instana® host agent
-
The following network policy is applied to all of the pods in the scheduling service project. The network policy allows the pods in the scheduling service project to send metrics to the Instana host agent on the cluster.
Before you apply the network policy, set theINSTANA_NAMESPACEenvironment variable to the project where Instana host agent is installed:exportINSTANA_NAMESPACE=<project-name>cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: instana namespace: ${PROJECT_SCHEDULING_SERVICE} spec: egress: - to: - podSelector: {} namespaceSelector: matchLabels: kubernetes.io/metadata.name: ${INSTANA_NAMESPACE} ports: - protocol: TCP port: 42699 podSelector: {} policyTypes: - Egress EOF
Network policies to isolate an instance of IBM Software Hub
A cluster administrator can create the following network policies to isolate an instance of IBM Software Hub:
- Deny all network traffic in the operands project
- Enable inter-pod communication in the operands project
- Enable connections from the Red Hat OpenShift Container Platform Ingress Controller
- Enable connections from the Red Hat OpenShift Container Platform monitoring stack
- Enable the web client to communicate with the operands project
- Enable the operands project to communicate with the operators project
These policies are combined to provide controlled access to the instance. You can repeat this process for each instance of IBM Software Hub on the cluster.
- Deny all network traffic in the operands project
-
The following network policy is applied to all of the pods in the operands project. The network policy rejects all incoming traffic to the operands project.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-by-default namespace: ${PROJECT_CPD_INST_OPERANDS} spec: podSelector: ingress: [] EOF - Enable inter-pod communication in the operands project
-
The following network policy is applied to all of the pods in the operands project. The network policy allows the pods in the operands project to communicate with each other.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-from-same-namespace namespace: ${PROJECT_CPD_INST_OPERANDS} spec: podSelector: {} policyTypes: - Ingress ingress: - from: - podSelector: {} EOF - Enable connections from the Red Hat OpenShift Container Platform Ingress Controller
-
The following network policy is applied to all of the pods in the operands project. The network policy allows the pods in the operands project to accept incoming communication from the Red Hat OpenShift Container Platform Ingress Controller.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-from-openshift-ingress namespace: ${PROJECT_CPD_INST_OPERANDS} spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: network.openshift.io/policy-group: ingress EOF - Enable connections from the Red Hat OpenShift Container Platform monitoring stack
-
The following network policy is applied to all of the pods in the operands project. The network policy allows the pods in the operands project to accept incoming communication from the Red Hat OpenShift Container Platform monitoring stack.
cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-from-openshift-monitoring namespace: ${PROJECT_CPD_INST_OPERANDS} spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: network.openshift.io/policy-group: monitoring EOF - Enable the web client to communicate with the operands project
-
The following network policy is applied to the
ibm-nginxpods in the operands project. The network policy allows theibm-nginxpods in the operands project to accept incoming communication from the IBM Software Hub web client.cat <<EOF |oc apply -f - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-access-to-front-door namespace: ${PROJECT_CPD_INST_OPERANDS} spec: podSelector: matchLabels: component: "ibm-nginx" policyTypes: - Ingress ingress: - {} EOF - Enable the operands project to communicate with the operators project
-
The following network policy is applied to all of the pods in the operands project. The network policy allows the pods in the operands project to accept incoming communication from the operators project for the instance.
cat <<EOF |oc apply -f - kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: allow-from-cpd-operator-ns namespace: ${PROJECT_CPD_INST_OPERANDS} spec: ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: ${PROJECT_CPD_INST_OPERATORS} podSelector: {} policyTypes: - Ingress EOF
Restricting egress
You should consider whether you need to take additional steps to restrict egress from IBM Software Hub. In some environments, such as clusters running in a restricted network, this might be unnecessary; your existing network configuration or firewall rules should be sufficient to restrict egress.
It is strongly recommended that you review the Red Hat OpenShift security guide to determine which security measures you should implement in your environment.
Network policies implemented by individual services
The following services implement additional network policies as part of their installation.
| Service | Automatically installed network policies |
|---|---|
| AI Factsheets | The service does not automatically create network policies. |
| Anaconda Repository for IBM Cloud Pak for Data | Not applicable. The service is not installed on the cluster. |
| Analytics Engine powered by Apache Spark | The service does not automatically create network policies. |
| Cognos Analytics | The service does not automatically create network policies. If you plan to provision an instance of Cognos Analytics in a tethered project and you applied network policies for the Certificate manager, License Service, and IBM Software Hub control plane, you must create a network policy to enable the service instance to communicate with these components. For more information on creating the network policy, see Adding a network policy for Cognos Analytics. |
| Cognos Dashboards | The service does not automatically create network policies. |
| Data Gate | Data Gate automatically creates the
following defensive network policies:
|
| Data Privacy | Data Privacy automatically creates the
following defensive network policies:
|
| Data Product Hub | |
| Data Refinery | The service does not automatically create network policies. |
| Data Replication | Data Replication automatically
creates the following defensive network policies:
|
| DataStage | DataStage automatically creates
the following defensive network policies:
|
| Data Virtualization | Data Virtualization automatically creates the
following defensive network policies:
|
| Db2 | Db2 automatically creates
the following defensive network policy:
In addition, when you create a database instance, Db2 automatically creates the following defensive network policies:
|
| Db2 Big SQL | Db2
Big SQL automatically creates
the following defensive network policies:
|
| Db2 Data Management Console | Db2
Data Management Console automatically creates
the following defensive network policies:
|
| Db2 Warehouse | Db2 Warehouse
automatically creates the following defensive network policy:
In addition, when you create a database instance, Db2 Warehouse automatically creates the following defensive network policies:
|
| Decision Optimization | Decision Optimization automatically creates the
following defensive network policy:
|
| EDB Postgres | The service does not automatically create network policies. |
| Execution Engine for Apache Hadoop | Execution Engine for Apache Hadoop automatically creates
the following defensive network policies:
|
| IBM Knowledge Catalog | When you install IBM Knowledge Catalog,
Db2U automatically creates the following
defensive network policies for the internal database:
|
| IBM Knowledge Catalog Premium | IBM Knowledge Catalog Premium automatically
creates the following defensive network policies:
In addition, when you install IBM Knowledge Catalog Premium, Db2U automatically creates the following defensive network policies for the internal database:
|
| IBM Knowledge Catalog Standard | IBM Knowledge Catalog Standard automatically
creates the following defensive network policies:
In addition, when you install IBM Knowledge Catalog Standard, Db2U automatically creates the following defensive network policies for the internal database:
|
| IBM Master Data Management | IBM
Master Data Management automatically creates the
following defensive network policies:
|
| IBM StreamSets | IBM
StreamSets automatically
creates the following defensive network policies:
|
| Informix | When you create a database instance, Informix automatically creates the following
defensive network policies:
|
| MANTA Automated Data Lineage | The service does not automatically create network policies. |
| OpenPages | When you create an OpenPages
service instance, OpenPages automatically
creates the following defensive network policy:
|
| Orchestration Pipelines | The service does not automatically create network policies. |
| Planning Analytics | The service does not automatically create network policies. |
| Product Master | Product Master automatically creates
the following defensive network policies:
|
| RStudio® Server Runtimes | The service does not automatically create network policies. |
| SPSS Modeler | The service does not automatically create network policies. |
| Synthetic Data Generator | The service does not automatically create network policies. |
| Voice Gateway | Voice Gateway automatically
creates the following network policy:
|
| Watson Discovery | Watson Discovery automatically creates
the following defensive network policies:
|
| Watson Machine Learning | The service does not automatically create network policies. |
| Watson OpenScale | Watson
OpenScale automatically creates the
following defensive network policies:
|
| Watson Speech services | Watson Speech services automatically creates
the following defensive network policy:
|
| Watson Studio | The service does not automatically create network policies. |
| Watson Studio Runtimes | The service does not automatically create network policies. |
| watsonx.ai™ | The service does not automatically create network policies. |
| watsonx Assistant | watsonx Assistant automatically creates
the following defensive network policies:
|
| watsonx Code Assistant™ | The service does not automatically create network policies. |
| Watsonx Code Assistant™ for Red Hat Ansible® Lightspeed | The service does not automatically create network policies. |
| watsonx.data™ | watsonx.data automatically
creates the following defensive network policies:
|
| watsonx.data integration | The StreamSets component in
watsonx.data integration automatically creates the
following defensive network policies:
|
| watsonx.governance™ |
|
| watsonx™ Orchestrate | watsonx
Orchestrate automatically creates
the following defensive network policies:
|