Configuring
Configuring MicroShift
Abstract
Chapter 1. Using the MicroShift configuration file Copy linkLink copied to clipboard!
A YAML file customizes MicroShift instances with your preferences, settings, and parameters.
1.1. Configuring Red Hat Device Edge Copy linkLink copied to clipboard!
MicroShift and Red Hat Enterprise Linux (RHEL) work together to bring a lighter-weight, single-node Kubernetes to the edge. This combination means that there is a single node that is both control-plane and worker. It also means that the operating system handles many functions. You add features by installing optional RPMs or Operators. In many cases, you must configure the operating system or other resources in addition to the MicroShift service.
Bringing many of these pieces together is the MicroShift configuration file, config.yaml
. The MicroShift configuration file customizes your application platform and can enable many advanced functions. For example:
- Ingress is available by default, but you can add advanced functions such as TLS and route admission specifications by using parameters in the MicroShift configuration file.
-
If you do not need storage, you can disable the built-in storage provider by using the MicroShift configuration file. If you do want to use the built-in storage provider, you must make your adjustments in the
lvmd.config
file. The role of the MicroShift configuration file in this case is to set whether you use the default storage provider. - Advanced networking functions, such as using multiple networks. The Multus package is an installable RPM, but you set up access by using the MicroShift configuration file to set parameters. In addition, you must configure network settings on your networks through the host.
For your convenience, a config.yaml.default
file is automatically installed. You can copy and rename this file config.yaml
and use it as a starting point for your own custom configuration.
You can also add features that operate without configurations to the MicroShift config.yaml
file. For example, you can install and configure GitOps for application management without configuring MicroShift.
If you want to make configuration changes or deploy applications through the MicroShift API with tools other than kustomize
manifests, you must wait until the greenboot health checks have finished. This ensures that your changes are not lost if greenboot rolls your rpm-ostree
system back to an earlier state.
1.2. The MicroShift YAML configuration file Copy linkLink copied to clipboard!
At startup, MicroShift checks the system-wide /etc/microshift/
directory for a configuration file named config.yaml
. If the configuration file does not exist in the directory, built-in default values are used to start the service.
You must use the MicroShift configuration file must be used in combination with host and, sometimes, application and service settings. Ensure that you configure each function in tandem, as needed, when you adjust settings for your MicroShift cluster.
For your convenience, a config.yaml.default
file ready for your inputs is automatically installed.
1.2.1. Default settings Copy linkLink copied to clipboard!
If you do not create a config.yaml
file or use a configuration snippet YAML file, default values are used. The following example shows the default configuration settings.
To see the default values, run the following command:
microshift show-config
$ microshift show-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Default values example output in YAML form
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.3. Using custom settings Copy linkLink copied to clipboard!
To create custom configurations, make a copy of the config.yaml.default
file that is provided in the /etc/microshift/
directory, renaming it config.yaml
. Keep this file in the /etc/microshift/
directory, and then you can change supported settings that are expected to override the defaults before starting or restarting MicroShift.
Restart MicroShift after changing any configuration settings to have them take effect. The config.yaml
file is read only when MicroShift starts.
1.3.1. Separate restarts Copy linkLink copied to clipboard!
Applications and other optional services used with your MicroShift cluster might also need to be restarted separately to apply configuration changes throughout the cluster. For example, when making changes to certain networking settings, you must stop and restart service and application pods to apply those changes. See each procedure for the task you are completing for more information.
If you add all of the configurations you need at the same time, you can minimize system restarts.
1.3.2. Parameters and values for the MicroShift config.yaml file Copy linkLink copied to clipboard!
The following table explains MicroShift configuration YAML parameters and valid values for each:
Field | Type | Description |
---|---|---|
|
| A string that specifies the IP address from which the API server is advertised to members of the cluster. The default value is calculated based on the address of the service network. |
|
|
How long log files are kept before automatic deletion. The default value of |
|
|
By default, when the |
|
| The total number of log files kept. By default, MicroShift retains 10 log files. The oldest is deleted when an excess file is created. This value can be configured. |
|
|
Logs only metadata for read and write requests; does not log request bodies except for OAuth access token requests. If you do not specify this field, the |
|
| Defines externally generated certificates and domain names by using custom certificate authorities. |
|
| The full path to the certificate. |
|
| The full path to the certificate key. |
|
| Optional. Add a list of explicit DNS names. Leading wildcards are allowed. If no names are provided, the implicit names are extracted from the certificates. |
|
Fully qualified domain names (FQDNs), wildcards such as | Subject Alternative Names for API server certificates. SANs indicate all of the domain names and IP addresses that are secured by a certificate. |
|
|
Log verbosity. Default is |
|
| Base domain of the cluster. All managed DNS records are subdomains of this base. |
|
|
By default, |
|
|
Determines the default HTTP version to be used for ingress. Default value is |
|
|
Specifies when and how the ingress router sets the
|
|
|
|
|
|
Not all MIME types benefit from compression, but |
|
|
The default value is
|
| IP address, NIC name, or multiple | Value defaults to the entire network of the host. The valid configurable value is a list that can be either a single IP address or NIC name or multiple IP addresses and NIC names. |
|
|
Default value is |
|
|
Default port shown. Configurable. Valid value is a single, unique port in the |
|
|
Default port shown. Configurable. Valid value is a single, unique port in the |
|
|
Describes how hostname claims across namespaces are handled. By default, allows routes to claim different paths of the same hostname across namespaces. Specifying |
|
|
Router status. Default is |
| Objects | Specifies options for tuning the performance of ingress controller pods. |
|
|
Defines how long a connection is held open while waiting for a client response to the server/backend before closing the connection. The default timeout is |
|
|
Defines how long a connection is held open while waiting for a client response. The default timeout is |
|
An |
Describes how much memory in bytes must be reserved for
|
|
|
Describes how much memory in bytes must be reserved from
|
|
|
The default
|
|
|
Default value is
|
|
|
Defines how long a connection is held open while waiting for a server or backend response to the client before closing the connection. The default timeout is |
|
|
Defines how long a connection is held open while waiting for a server or backend response. The default timeout is |
|
|
Defines the number of threads created per
|
|
| Defines how long the router can hold data to find a matching route. Setting this interval with too short a value can cause the router to revert to the default certificate for edge-terminated clients or re-encrypt routes, even when a better-matching certificate could be used.
|
|
|
Defines how long a tunnel connection, including websockets, are held open while the tunnel is idle. The default timeout is |
| See the MicroShift low-latency instructions | Parameter for passthrough configuration of the kubelet node agent. Used for low-latency configuration. Default value is null. |
|
|
The locations on the file system to scan for |
| IP address block |
A block of IP addresses from which pod IP addresses are allocated. IPv4 is the default network. Dual-stack entries are supported. The first entry in this field is immutable after MicroShift starts. Default range is |
| String |
Deploys the Open Virtual Networking - Kubernetes (OVN-K) network plugin as the default container network interface (CNI) when empty or set to |
| IP address block |
A block of virtual IP addresses for Kubernetes services. IP address pool for services. IPv4 is the default. Dual-stack entries are supported. The first entry in this field is immutable after MicroShift starts. Default range is |
|
|
The port range allowed for Kubernetes services of type |
|
| The name of the node. The default value is the hostname. If non-empty, this string is used to identify the node instead of the hostname. This value is immutable after MicroShift starts. |
| IPv4 address | The IPv4 address of the node. The default value is the IP address of the default route. |
| IPv6 address | The IPv6 address for the node for dual-stack configurations. Cannot be configured in single stack for either IPv4 or IPv6. Default is an empty value or null. |
|
| Default value is empty. An empty value or null field defaults to LVMS deployment. |
|
|
Default value is null or an empty array. A null or empty array defaults to deploying |
1.3.3. Using configuration snippets Copy linkLink copied to clipboard!
If you want to configure one or two settings, such as adding subject alternative names (SANs), you can use the /etc/microshift/config.d/
configuration directory to drop in configuration snippet YAML files. You must restart MicroShift for new configurations to apply.
To return to previous values, you can delete a configuration snippet and restart MicroShift.
1.3.3.1. How configuration snippets work Copy linkLink copied to clipboard!
At runtime, the YAML files inside /etc/microshift/config.d
are merged into the existing MicroShift configuration, whether that configuration is a result of default values or a user-created config.yaml
file. You do not need to create a config.yaml
file to use a configuration snippet.
Files in the snippet directory are sorted in lexicographical order and run sequentially. You can use numerical prefixes for snippets so that each is read in the order you want. The last-read file takes precedence when there is more than one YAML for the same parameter.
Configuration snippets take precedence over both default values and a customized config.yaml
configuration file.
1.3.3.2. Example list configuration snippets Copy linkLink copied to clipboard!
Lists, or arrays, are not merged, they are overwritten. For example, you can replace a SAN or list of SANs by creating an additional snippet for the same field that is read after the first:
MicroShift configuration directory contents
-
/etc/microshift/config.yaml.default
or/etc/microshift/config.yaml
Example MicroShift configuration snippet directory contents
-
/etc/microshift/config.d/10-san.yaml
/etc/microshift/config.d/20-san.yaml
Example
10-san.yaml
snippetapiServer: subjectAltNames: - host1 - host2
apiServer: subjectAltNames: - host1 - host2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
20-san.yaml
snippetapiServer: subjectAltNames: - hostZ
apiServer: subjectAltNames: - hostZ
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example configuration result
apiServer: subjectAltNames: - hostZ
apiServer: subjectAltNames: - hostZ
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you want to add a value to an existing list, you can add it to an existing snippet. For example, to add hostZ
to an existing list of SANs, edit the snippet you have instead of creating a new one:
Example 10-san.yaml
snippet
apiServer: subjectAltNames: - host1 - host2 - hostZ
apiServer:
subjectAltNames:
- host1
- host2
- hostZ
Example configuration result
apiServer: subjectAltNames: - host1 - host2 - hostZ
apiServer:
subjectAltNames:
- host1
- host2
- hostZ
1.3.3.3. Example object configuration snippets Copy linkLink copied to clipboard!
Objects are merged together.
Example 10-advertiseAddress.yaml
snippet
apiServer: advertiseAddress: "microshift-example"
apiServer:
advertiseAddress: "microshift-example"
Example 20-audit-log.yaml
snippet
apiServer: auditLog: maxFileAge: 12
apiServer:
auditLog:
maxFileAge: 12
Example configuration result
apiServer: advertiseAddress: "microshift-example" auditLog: maxFileAge: 12
apiServer:
advertiseAddress: "microshift-example"
auditLog:
maxFileAge: 12
1.3.3.4. Example mixed configuration snippets Copy linkLink copied to clipboard!
In this example, the values of both advertiseAddress
and auditLog.maxFileAge
fields are merged into the configuration, but only the c.com
and d.com
subjectAltNames
values are retained because the numbering in the filename indicates that they are higher priority.
Example 10-advertiseAddress.yaml
snippet
apiServer: advertiseAddress: "microshift-example"
apiServer:
advertiseAddress: "microshift-example"
Example 20-audit-log.yaml
snippet
apiServer: auditLog: maxFileAge: 12
apiServer:
auditLog:
maxFileAge: 12
Example 30-SAN.yaml
snippet
apiServer: subjectAltNames: - a.com - b.com
apiServer:
subjectAltNames:
- a.com
- b.com
Example 40-SAN.yaml
snippet
apiServer: subjectAltNames: - c.com - d.com
apiServer:
subjectAltNames:
- c.com
- d.com
Example configuration result
1.3.4. Configuring the advertise address network flag Copy linkLink copied to clipboard!
The apiserver.advertiseAddress
flag specifies the IP address on which to advertise the API server to members of the cluster. This address must be reachable by the cluster. You can set a custom IP address here, but you must also add the IP address to a host interface. Customizing this parameter preempts MicroShift from adding a default IP address to the br-ex
network interface.
If you customize the advertiseAddress
IP address, make sure it is reachable by the cluster when MicroShift starts by adding the IP address to a host interface.
If unset, the default value is set to the next immediate subnet after the service network. For example, when the service network is 10.43.0.0/16
, the advertiseAddress
is set to 10.44.0.0/32
.
1.3.5. Extending the port range for NodePort services Copy linkLink copied to clipboard!
The serviceNodePortRange
setting extends the port range available to NodePort services. This option is useful when specific standard ports under the 30000-32767
range need to be exposed. For example, if your device needs to expose the 1883/tcp
MQ Telemetry Transport (MQTT) port on the network because client devices cannot use a different port.
NodePorts can overlap with system ports, causing a malfunction of the system or MicroShift.
Consider the following when configuring the NodePort service ranges:
-
Do not create any NodePort service without an explicit
nodePort
selection. When an explicitnodePort
is not specified, the port is assigned randomly by thekube-apiserver
and cannot be predicted. -
Do not create any NodePort service for any system service port, MicroShift port, or other services you expose on your device
HostNetwork
. Table one specifies ports to avoid when extending the port range:
Expand Table 1.2. Ports to avoid. Port Description 22/tcp
SSH port
80/tcp
OpenShift Router HTTP endpoint
443/tcp
OpenShift Router HTTPS endpoint
1936/tcp
Metrics service for the openshift-router, not exposed today
2379/tcp
etcd port
2380/tcp
etcd port
6443
kubernetes API
8445/tcp
openshift-route-controller-manager
9537/tcp
cri-o metrics
10250/tcp
kubelet
10248/tcp
kubelet healthz port
10259/tcp
kube scheduler
Chapter 2. Configuring IPv6 single or dual-stack networking Copy linkLink copied to clipboard!
You can use the IPv6 networking protocol in either single-stack or dual-stack networking modes.
2.1. IPv6 networking with MicroShift Copy linkLink copied to clipboard!
The MicroShift service defaults to IPv4 address families cluster-wide. However, IPv6 single-stack and IPv4/IPv6 dual-stack networking is available on supported platforms.
- When you set the values for IPv6 in the MicroShift configuration file and restart the service, settings managed by the OVN-Kubernetes network plugin are updated automatically.
- After migrating to dual-stack networking, both new and existing pods have dual-stack networking enabled.
- If you require cluster-wide IPv6 access, such as for the control plane and other services, use the following configuration examples. The MicroShift Multus Container Network Interface (CNI) plugin can enable IPv6 for pods.
- For dual-stack networking, each MicroShift cluster network and service network supports up to two values in the cluster and service network configuration parameters.
Plan for IPv6 before starting MicroShift for the first time. Switching a cluster to and from different IP families is not supported unless you are migrating a cluster from default single-stack to dual-stack networking.
If you configure your networking for either IPv6 single stack or IPv4/IPv6 dual stack, you must restart application pods and services. Otherwise pods and services remain configured with the default IP family.
2.2. Configuring IPv6 single-stack networking Copy linkLink copied to clipboard!
You can use the IPv6 network protocol by updating the MicroShift service configuration file.
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You have root access to the cluster.
- Your cluster uses the OVN-Kubernetes network plugin.
- The host has an IPv6 address and IPv6 routes, including the default.
Procedure
-
If you have not done so, make a copy of the provided
config.yaml.default
file in the/etc/microshift/
directory, renaming itconfig.yaml
. Keep the new MicroShift
config.yaml
in the/etc/microshift/
directory. Yourconfig.yaml
file is read every time the MicroShift service starts.NoteAfter you create it, the
config.yaml
file takes precedence over built-in settings.Replace the default values in the
network
section of the MicroShift YAML with your valid values.Example single-stack IPv6 networking configuration
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify a
clusterNetwork
with a CIDR value that is less than64
. - 2
- Specify an IPv6 CIDR with a prefix of
112
. Kubernetes uses only the lowest 16 bits. For a prefix of112
, IP addresses are assigned from112
to128
bits. - 3
- Example node IP address. Valid values are IP addresses in the IPv6 address family. You must only specify an IPv6 address when an IPv4 network is also present. If an IPv4 network is not present, the MicroShift service automatically fills in this value upon restart.
Complete any other configurations you require, then start MicroShift by running the following command:
sudo systemctl start microshift
$ sudo systemctl start microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Retrieve the networks defined in the node resource by running the following command:
oc get node -o jsonpath='{.items[].spec.podCIDRs[]}'
$ oc get node -o jsonpath='{.items[].spec.podCIDRs[]}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
fd01::/48
fd01::/48
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the status of the pods by running the following command:
oc get pod -A -o wide
$ oc get pod -A -o wide
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the status of services by running the following command:
oc get svc -A
$ oc get svc -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Configuring IPv6 dual-stack networking before MicroShift starts Copy linkLink copied to clipboard!
You can configure your MicroShift cluster to run on dual-stack networking that supports IPv4 and IPv6 address families by using the configuration file before starting the service.
- The first IP family in the configuration is the primary IP stack in the cluster.
- After the cluster is running with dual-stack networking, enable application pods and add-on services for dual-stack by restarting them.
The OVN-Kubernetes network plugin requires that both IPv4 and IPv6 default routes be on the same network device. IPv4 and IPv6 default routes on separate network devices is not supported.
When using dual-stack networking where IPv6 is required, you cannot use IPv4-mapped IPv6 addresses, such as ::FFFF:198.51.100.1
.
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You have root access to the cluster.
- Your cluster uses the OVN-Kubernetes network plugin.
- The host has both IPv4 and IPv6 addresses and routes, including a default for each.
- The host has at least two L3 networks, IPv4 and IPv6.
Procedure
-
If you have not done so, make a copy of the provided
config.yaml.default
file in the/etc/microshift/
directory, renaming itconfig.yaml
. Keep the new MicroShift
config.yaml
in the/etc/microshift/
directory. Yourconfig.yaml
file is read every time the MicroShift service starts.NoteAfter you create it, the
config.yaml
file takes precedence over built-in settings.If you have not started MicroShift, replace the default values in the
network
section of the MicroShift YAML with your valid values.Example dual-stack IPv6 networking configuration with network assignments
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify an IPv6
clusterNetwork
with a CIDR value that is less than64
. - 2
- Specify an IPv6 CIDR with a prefix of
112
. Kubernetes uses only the lowest 16 bits. For a prefix of112
, IP addresses are assigned from112
to128
bits. - 3
- Example node IP address. Must be an IPv4 address family.
- 4
- Example node IP address for dual-stack configuration. Must be an IPv6 address family. Configurable only with dual-stack networking.
Complete any other MicroShift configurations you require, then start MicroShift by running the following command:
sudo systemctl start microshift
$ sudo systemctl start microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reset the IP family policy for application pods and services as needed, then restart those application pods and services to enable dual-stack networking. See "Resetting the IP family policy for application pods and services" for a simple example.
Verification
You can verify that all of the system services and pods to have two IP addresses, one for each family, by using the following steps:
Retrieve the networks defined in the node resource by running the following command:
oc get pod -n openshift-ingress router-default-5b75594b4-w7w6s -o jsonpath='{.status.podIPs}'
$ oc get pod -n openshift-ingress router-default-5b75594b4-w7w6s -o jsonpath='{.status.podIPs}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
[{"ip":"10.42.0.4"},{"ip":"fd01:0:0:1::4"}]
[{"ip":"10.42.0.4"},{"ip":"fd01:0:0:1::4"}]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the networks defined by the host network pods by running the following command:
oc get pod -n openshift-ovn-kubernetes ovnkube-master-2fm2k -o jsonpath='{.status.podIPs}'
$ oc get pod -n openshift-ovn-kubernetes ovnkube-master-2fm2k -o jsonpath='{.status.podIPs}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
[{"ip":"192.168.113.117"},{"ip":"2001:db9:ca7:ff::1db8"}]
[{"ip":"192.168.113.117"},{"ip":"2001:db9:ca7:ff::1db8"}]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.4. Migrating a MicroShift cluster to IPv6 dual-stack networking Copy linkLink copied to clipboard!
You can convert a single-stack cluster to dual-stack cluster networking that supports IPv4 and IPv6 address families by setting two entries in the service and cluster network parameters in the MicroShift configuration file.
- The first IP family in the configuration is the primary IP stack in the cluster.
- MicroShift system pods and services are automatically updated upon MicroShift restart.
- After the cluster is migrated to dual-stack networking and has restarted, enable workload pods and services for dual-stack networking by restarting them.
The OVN-Kubernetes network plugin requires that both IPv4 and IPv6 default routes be on the same network device. IPv4 and IPv6 default routes on separate network devices is not supported.
When using dual-stack networking where IPv6 is required, you cannot use IPv4-mapped IPv6 addresses, such as ::FFFF:198.51.100.1
.
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You have root access to the cluster.
- Your cluster uses the OVN-Kubernetes network plugin.
- The host has both IPv4 and IPv6 addresses and routes, including a default for each.
- The host has at least two L3 networks, IPv4 and IPv6.
Procedure
-
If you have not done so, make a copy of the provided
config.yaml.default
file in the/etc/microshift/
directory, renaming itconfig.yaml
. Keep the new MicroShift
config.yaml
in the/etc/microshift/
directory. Yourconfig.yaml
file is read every time the MicroShift service starts.NoteAfter you create it, the
config.yaml
file takes precedence over built-in settings.Add IPv6 configurations to the
network
section of the MicroShift YAML with your valid values:WarningYou must keep the same first entry across restarts and migrations. This is true for any migration: single-to-dual stack, or dual-to-single stack. A complete wipe of the etcd database is required if a change to the first entry is needed. This might result in application data loss and is not supported.
-
Add an IPv6 configuration for a second network in the
network
section of the MicroShift YAML with your valid values. Add network assignments to the
network
section of the MicroShiftconfig.yaml
to enable dual stack with IPv6 as secondary network.Example dual-stack IPv6 configuration with network assignments
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The IPv6 node address.
- 2
- IPv4 network. Specify a
clusterNetwork
with a CIDR value that is less than24
. - 3
- IPv6 network. Specify a
clusterNetwork
with a CIDR value that is less than64
. - 4
- Specify an IPv6 CIDR with a prefix of
112
. Kubernetes uses only the lowest 16 bits. For a prefix of112
, IP addresses are assigned from112
to128
bits. - 5
- Example node IP address. Maintain the previous IPv4 IP address.
- 6
- Example node IP address. Must be an IPv6 address family.
-
Add an IPv6 configuration for a second network in the
Complete any other configurations you require, then restart MicroShift by running the following command:
sudo systemctl restart microshift
$ sudo systemctl restart microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reset the IP family policy for application pods and services as needed, then restart those application pods and services to enable dual-stack networking. See "Resetting the IP family policy for application pods and services" for a simple example.
Verification
You can verify that all of the system services and pods to have two IP addresses, one for each family, by using the following steps:
Retrieve the status of the pods by running the following command:
oc get pod -A -o wide
$ oc get pod -A -o wide
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the networks defined by the OVN-K network plugin by running the following command:
oc get pod -n openshift-ovn-kubernetes ovnkube-master-bltk7 -o jsonpath='{.status.podIPs}'
$ oc get pod -n openshift-ovn-kubernetes ovnkube-master-bltk7 -o jsonpath='{.status.podIPs}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
[{"ip":"192.168.113.117"},{"ip":"2001:db9:ca7:ff::1db8"}]
[{"ip":"192.168.113.117"},{"ip":"2001:db9:ca7:ff::1db8"}]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the networks defined in the node resource by running the following command:
oc get pod -n openshift-ingress router-default-5b75594b4-228z7 -o jsonpath='{.status.podIPs}'
$ oc get pod -n openshift-ingress router-default-5b75594b4-228z7 -o jsonpath='{.status.podIPs}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
[{"ip":"10.42.0.3"},{"ip":"fd01:0:0:1::3"}]
[{"ip":"10.42.0.3"},{"ip":"fd01:0:0:1::3"}]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To return to single-stack networking, you can remove the second entry to the networks and return to the single stack that was configured before migrating to dual-stack.
2.5. Resetting the IP family policy for application pods and services Copy linkLink copied to clipboard!
The default ipFamilyPolicy
configuration value, PreferSingleStack
, does not automatically update in all services after you update your MicroShift configuration to dual-stack networking. To enable dual-stack networking in services and application pods, you must update the ipFamilyPolicy
value.
Prerequisites
-
You used the MicroShift
config.yaml
to define a dual-stack network with an IPv6 address family.
Procedure
Set the
spec.ipFamilyPolicy
field to a valid value for dual-stack networking in your service or pod by using the following example:Example dual-stack network configuration for a service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Required. Valid values for dual-stack networking are
PreferDualStack
andRequireDualStack
. The value you set depends on the requirements of your application.PreferSingleStack
is the default value for theipFamilyPolicy
field.
-
Restart any application pods that do not have a
hostNetwork
defined. Pods that do have ahostNetwork
defined do not need to be restarted to update theipFamilyPolicy
value.
MicroShift system services and pods are automatically updated when the ipFamilyPolicy
value is updated.
2.6. OVN-Kubernetes IPv6 and dual-stack limitations Copy linkLink copied to clipboard!
The OVN-Kubernetes network plugin has the following limitations:
For a cluster configured for dual-stack networking, both IPv4 and IPv6 traffic must use the same network interface as the default gateway.
If this requirement is not met, pods on the host in the
ovnkube-node
daemon set enter theCrashLoopBackOff
state.If you display a pod with a command such as
oc get pod -n openshift-ovn-kubernetes -l app=ovnkube-node -o yaml
, thestatus
field has more than one message about the default gateway, as shown in the following output:I1006 16:09:50.985852 60651 helper_linux.go:73] Found default gateway interface br-ex 192.168.127.1 I1006 16:09:50.985923 60651 helper_linux.go:73] Found default gateway interface ens4 fe80::5054:ff:febe:bcd4 F1006 16:09:50.985939 60651 ovnkube.go:130] multiple gateway interfaces detected: br-ex ens4
I1006 16:09:50.985852 60651 helper_linux.go:73] Found default gateway interface br-ex 192.168.127.1 I1006 16:09:50.985923 60651 helper_linux.go:73] Found default gateway interface ens4 fe80::5054:ff:febe:bcd4 F1006 16:09:50.985939 60651 ovnkube.go:130] multiple gateway interfaces detected: br-ex ens4
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The only resolution is to reconfigure the host networking so that both IP families use the same network interface for the default gateway.
For a cluster configured for dual-stack networking, both the IPv4 and IPv6 routing tables must contain the default gateway.
If this requirement is not met, pods on the host in the
ovnkube-node
daemon set enter theCrashLoopBackOff
state.If you display a pod with a command such as
oc get pod -n openshift-ovn-kubernetes -l app=ovnkube-node -o yaml
, thestatus
field has more than one message about the default gateway, as shown in the following output:I0512 19:07:17.589083 108432 helper_linux.go:74] Found default gateway interface br-ex 192.168.123.1 F0512 19:07:17.589141 108432 ovnkube.go:133] failed to get default gateway interface
I0512 19:07:17.589083 108432 helper_linux.go:74] Found default gateway interface br-ex 192.168.123.1 F0512 19:07:17.589141 108432 ovnkube.go:133] failed to get default gateway interface
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The only resolution is to reconfigure the host networking so that both IP families contain the default gateway.
-
If you set the
ipv6.disable
parameter to1
in thekernelArgument
section of theMachineConfig
custom resource (CR) for your cluster, OVN-Kubernetes pods enter aCrashLoopBackOff
state. Additionally, updating your cluster to a later version of Red Hat build of MicroShift fails because the Network Operator remains on aDegraded
state. Red Hat does not support disabling IPv6 adddresses for your cluster so do not set theipv6.disable
parameter to1
.
Chapter 3. Using ingress control for a MicroShift cluster Copy linkLink copied to clipboard!
Use the ingress controller options in the MicroShift configuration file to make pods and services accessible outside the cluster.
3.1. Using ingress control in MicroShift Copy linkLink copied to clipboard!
When you create your MicroShift cluster, each pod and service running on the cluster is allocated an IP address. These IP addresses are accessible to other pods and services running nearby by default, but are not accessible to external clients. MicroShift uses a minimal implementation of the OpenShift Container Platform IngressController
API to enable external access to cluster services.
With more configuration options, you can fine-tune ingress to meet your specific needs. To use enhanced ingress control, update the parameters in the MicroShift configuration file and restart the service. Ingress configuration is useful in a variety of ways, for example:
-
If your application starts processing requests from clients but the connection is closed before it can respond, you can set the
ingress.tuningOptions.serverTimeout
parameter in the configuration file to a higher value to accommodate the speed of the response from the server. -
If the router has many connections open because an application running on the cluster does not close connections properly, you can set the
ingress.tuningOptions.serverTimeout
andspec.tuningOptions.serverFinTimeout
parameters to a lower value, forcing those connections to close sooner.
3.2. Configuring ingress control in MicroShift Copy linkLink copied to clipboard!
You can use detailed ingress control settings by updating the MicroShift service configuration file.
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You have root access to the cluster.
- Your cluster uses the OVN-Kubernetes network plugin.
Procedure
Apply ingress control settings in one of the two following ways:
Update the MicroShift
config.yaml
configuration file by making a copy of the providedconfig.yaml.default
file in the/etc/microshift/
directory, naming itconfig.yaml
and keeping it in the source directory.-
After you create it, the
config.yaml
file takes precedence over built-in settings. The configuration file is read every time the MicroShift service starts.
-
After you create it, the
Use a configuration snippet to apply the ingress control settings you want. To do this, create a configuration snippet YAML file and put it in the
/etc/microshift/config.d/
configuration directory.-
Configuration snippet YAMLs take precedence over both built-in settings and a
config.yaml
configuration file. See the Additional resources links for more information.
-
Configuration snippet YAMLs take precedence over both built-in settings and a
Replace the default values in the
network
section of the MicroShift YAML with your valid values, or create a configuration snippet file with the sections you need.Ingress controller configuration fields with default values
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 3.1. Ingress controller configuration fields definitions table Parameter Description defaultHTTPVersion
Sets the HTTP version for the ingress controller. Default value is
1
for HTTP 1.1.forwardedHeaderPolicy
Specifies when and how the ingress controller sets the
Forwarded
,X-Forwarded-For
,X-Forwarded-Host
,X-Forwarded-Port
,X-Forwarded-Proto
, andX-Forwarded-Proto-Version
HTTP headers. The following values are valid:-
Append
, preserves any existing headers by specifying that the ingress controller appends them. -
Replace
, removes any existing headers by specifying that the ingress controller sets the headers. -
IfNone
sets the headers set by specifying that the ingress controller sets the headers if they are not already set. -
Never
, preserves any existing headers by specifying that the ingress controller never sets the headers.
httpCompression
Defines the policy for HTTP traffic compression.
-
httpCompression.mimeTypes
defines a list of or a single MIME type to which compression is applied. For example,text/css; charset=utf-8
,text/html
,text/*
,image/svg+xml
,application/octet-stream
,X-custom/customsub
, using the format pattern,type/subtype; [;attribute=value]
. Thetypes
are: application, image, message, multipart, text, video, or a custom type prefaced byX-
. To see the full notation for MIME types and subtypes, see RFC1341 (IETF Datatracker documentation).
httpEmptyRequestsPolicy
Describes how HTTP connections are handled if the connection times out before a request is received. Allowed values for this field are
Respond
andIgnore
. The default value isRespond
. The following are valid values:-
Respond
, causes the ingress controller to send an HTTP400
or408
response, logs the connection if access logging is enabled, and counts the connection in the appropriate metrics. -
Ignore
, adds thehttp-ignore-probes
parameter in theHAproxy
configuration. If the field is set toIgnore
, the ingress controller closes the connection without sending a response, then logs the connection or incrementing metrics.
Usually, empty request connections come from load balancer health probes or web browser preconnects and can be safely ignored. However, network errors and port scans can also create these empty requests, so setting this field to
Ignore
can impede detecting or diagnosing problems and also impede the detection of intrusion attempts.logEmptyRequests
Specifies connections for which no request is received and logged. Usually, these empty requests come from load balancer health probes or web browser speculative connections such as preconnects. Logging these types of empty requests can be undesirable. However, network errors and port scans can also create empty requests, so setting this field to
Ignore
can impede detecting or diagnosing problems and also impede the detection of intrusion attempts.The following are valid values:
-
Log
, which indicates that an event should be logged. -
Ignore
, which sets thedontlognull
option in theHAproxy
configuration.
tuningOptions
Specifies options for tuning the performance of ingress controller pods.
-
The
tuningOptions.clientFinTimeout
parameter specifies how long a connection is held open while waiting for the client response to the server closing the connection. The default timeout is1s
. -
The
tuningOptions.clientTimeout
parameter specifies how long a connection is held open while waiting for a client response. The default timeout is30s
. The
tuningOptions.headerBufferBytes
parameter specifies how much memory is reserved, in bytes, for Ingress Controller connection sessions. This value must be at least16384
if HTTP/2 is enabled for the Ingress Controller. If not set, the default value is32768
bytes.ImportantSetting this field not recommended because
headerBufferMaxRewriteBytes
parameter values that are too small can break the ingress controller. Conversely, values forheaderBufferMaxRewriteBytes
that are too large could cause the ingress controller to use significantly more memory than necessary.-
The
tuningOptions.headerBufferMaxRewriteBytes
parameter specifies how much memory should be reserved, in bytes, fromheaderBufferBytes
for HTTP header rewriting and appending for Ingress Controller connection sessions. The minimum value forheaderBufferMaxRewriteBytes
is4096
. TheheaderBufferBytes
value must be greater than theheaderBufferMaxRewriteBytes
value for incoming HTTP requests. If not set, the default value is
8192
bytes.ImportantSetting this field is not recommended because
headerBufferMaxRewriteBytes
parameter values that are too small can break the ingress controller. Conversely, values forheaderBufferMaxRewriteBytes
that are too large could cause the ingress controller to use significantly more memory than necessary.-
The
tuningOptions.healthCheckInterval
parameter specifies how long the router waits between health checks. The default is5s
. -
The
tuningOptions.serverFinTimeout
parameter specifies how long a connection is held open while waiting for the server response to the client that is closing the connection. The default timeout is1s
. -
The
tuningOptions.serverTimeout
parameter specifies how long a connection is held open while waiting for a server response. The default timeout is30s
. The
tuningOptions.threadCount
parameter specifies the number of threads to create per HAProxy process. Creating more threads allows each ingress controller pod to handle more connections, at the cost of more system resources being used.HAProxy
supports up to64
threads. If this field is empty, default value is4
threads.ImportantSetting this field is not recommended because increasing the number of
HAProxy
threads allows ingress controller pods to use more CPU time under load, and prevent other pods from receiving the CPU resources they need to perform.-
The
tuningOptions.tlsInspectDelay
parameter specifies how long the router can hold data to find a matching route. Setting this value too short can cause the router to fall back to the default certificate for edge-terminated, re-encrypted, or passthrough routes, even when using a better-matched certificate. The default inspect delay is5s
. -
The
tuningOptions.tunnelTimeout
parameter specifies how long a tunnel connection, including websockets, remains open while the tunnel is idle. The default timeout is1h
.
-
Complete any other configurations you require, then start or restart MicroShift by running one the following commands:
sudo systemctl start microshift
$ sudo systemctl start microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow sudo systemctl restart microshift
$ sudo systemctl restart microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
After making ingress configuration changes and restarting MicroShift, you can check the age of the router pod to ensure that changes have been applied.
To check the status of the router pod, run the following command:
oc get pods -n openshift-ingress
$ oc get pods -n openshift-ingress
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY STATUS RESTARTS AGE router-default-8649b5bf65-w29cn 1/1 Running 0 6m10s
NAME READY STATUS RESTARTS AGE router-default-8649b5bf65-w29cn 1/1 Running 0 6m10s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Cluster access with kubeconfig Copy linkLink copied to clipboard!
Learn about how kubeconfig
files are used with MicroShift deployments. CLI tools use kubeconfig
files to communicate with the API server of a cluster. These files provide cluster details, IP addresses, and other information needed for authentication.
4.1. Kubeconfig files for configuring cluster access Copy linkLink copied to clipboard!
The two categories of kubeconfig
files used in MicroShift are local access and remote access. Every time MicroShift starts, a set of kubeconfig
files for local and remote access to the API server are generated. These files are generated in the /var/lib/microshift/resources/kubeadmin/
directory using preexisting configuration information.
Each access type requires a different authentication certificate signed by different Certificate Authorities (CAs). The generation of multiple kubeconfig
files accommodates this need.
You can use the appropriate kubeconfig
file for the access type needed in each case to provide authentication details. The contents of MicroShift kubeconfig
files are determined by either default built-in values or a config.yaml
file.
A kubeconfig
file must exist for the cluster to be accessible. The values are applied from built-in default values or a config.yaml
, if one was created.
Example contents of the kubeconfig files
4.2. Local access kubeconfig file Copy linkLink copied to clipboard!
The local access kubeconfig
file is written to /var/lib/microshift/resources/kubeadmin/kubeconfig
. This kubeconfig
file provides access to the API server using localhost
. Choose this file when you are connecting the cluster locally.
Example contents of kubeconfig
for local access
clusters: - cluster: certificate-authority-data: <base64 CA> server: https://localhost:6443
clusters:
- cluster:
certificate-authority-data: <base64 CA>
server: https://localhost:6443
The localhost
kubeconfig
file can only be used from a client connecting to the API server from the same host. The certificates in the file do not work for remote connections.
4.2.1. Accessing the MicroShift cluster locally Copy linkLink copied to clipboard!
Use the following procedure to access the MicroShift cluster locally by using a kubeconfig
file.
Prerequisites
-
You have installed the
oc
binary.
Procedure
Optional: to create a
~/.kube/
folder if your Red Hat Enterprise Linux (RHEL) machine does not have one, run the following command:mkdir -p ~/.kube/
$ mkdir -p ~/.kube/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the generated local access
kubeconfig
file to the~/.kube/
directory by running the following command:sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/config
$ sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the permissions on your
~/.kube/config
file by running the following command:chmod go-r ~/.kube/config
$ chmod go-r ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that MicroShift is running by entering the following command:
oc get all -A
$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3. Remote access kubeconfig files Copy linkLink copied to clipboard!
When a MicroShift cluster connects to the API server from an external source, a certificate with all of the alternative names in the SAN field is used for validation. MicroShift generates a default kubeconfig
for external access using the hostname
value. The defaults are set in the <node.hostnameOverride>
, <node.nodeIP>
and api.<dns.baseDomain>
parameter values of the default kubeconfig
file.
The /var/lib/microshift/resources/kubeadmin/<hostname>/kubeconfig
file uses the hostname
of the machine, or node.hostnameOverride
if that option is set, to reach the API server. The CA of the kubeconfig
file is able to validate certificates when accessed externally.
Example contents of a default kubeconfig
file for remote access
clusters: - cluster: certificate-authority-data: <base64 CA> server: https://microshift-rhel9:6443
clusters:
- cluster:
certificate-authority-data: <base64 CA>
server: https://microshift-rhel9:6443
4.3.1. Remote access customization Copy linkLink copied to clipboard!
Multiple remote access kubeconfig
file values can be generated for accessing the cluster with different IP addresses or host names. An additional kubeconfig
file generates for each entry in the apiServer.subjectAltNames
parameter. You can copy remote access kubeconfig
files from the host during times of IP connectivity and then use them to access the API server from other workstations.
4.4. Generating additional kubeconfig files for remote access Copy linkLink copied to clipboard!
You can generate additional kubeconfig
files to use if you need more host names or IP addresses than the default remote access file provides.
You must restart MicroShift for configuration changes to be implemented.
Prerequisites
-
You have created a
config.yaml
for MicroShift.
Procedure
Optional: You can show the contents of the
config.yaml
. Run the following command:cat /etc/microshift/config.yaml
$ cat /etc/microshift/config.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: You can show the contents of the remote-access
kubeconfig
file. Run the following command:cat /var/lib/microshift/resources/kubeadmin/<hostname>/kubeconfig
$ cat /var/lib/microshift/resources/kubeadmin/<hostname>/kubeconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantAdditional remote access
kubeconfig
files must include one of the server names listed in the Red Hat build of MicroShiftconfig.yaml
file. Additionalkubeconfig
files must also use the same CA for validation.To generate additional
kubeconfig
files for additional DNS names SANs or external IP addresses, add the entries you need to theapiServer.subjectAltNames
field. In the following example, the DNS name used isalt-name-1
and the IP address is1.2.3.4
.Example
config.yaml
with additional authentication valuesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart MicroShift to apply configuration changes and auto-generate the
kubeconfig
files you need by running the following command:sudo systemctl restart microshift
$ sudo systemctl restart microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To check the contents of additional remote-access
kubeconfig
files, insert the name or IP address as listed in theconfig.yaml
into thecat
command. For example,alt-name-1
is used in the following example command:cat /var/lib/microshift/resources/kubeadmin/alt-name-1/kubeconfig
$ cat /var/lib/microshift/resources/kubeadmin/alt-name-1/kubeconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Choose the
kubeconfig
file to use that contains the SAN or IP address you want to use to connect your cluster. In this example, thekubeconfig
containing`alt-name-1` in thecluster.server
field is the correct file.Example contents of an additional
kubeconfig
fileclusters: - cluster: certificate-authority-data: <base64 CA> server: https://alt-name-1:6443
clusters: - cluster: certificate-authority-data: <base64 CA> server: https://alt-name-1:6443
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
/var/lib/microshift/resources/kubeadmin/alt-name-1/kubeconfig
file values are from theapiServer.subjectAltNames
configuration values.
All of these parameters are included as common names (CN) and subject alternative names (SAN) in the external serving certificates for the API server.
4.4.1. Opening the firewall for remote access to the MicroShift cluster Copy linkLink copied to clipboard!
Use the following procedure to open the firewall so that a remote user can access the MicroShift cluster. This procedure must be completed before a workstation user can access the cluster remotely.
For this procedure, user@microshift
is the user on the MicroShift host machine and is responsible for setting up that machine so that it can be accessed by a remote user on a separate workstation.
Prerequisites
-
You have installed the
oc
binary. - Your account has cluster administration privileges.
Procedure
As
user@microshift
on the MicroShift host, open the firewall port for the Kubernetes API server (6443/tcp
) by running the following command:sudo firewall-cmd --permanent --zone=public --add-port=6443/tcp && sudo firewall-cmd --reload
[user@microshift]$ sudo firewall-cmd --permanent --zone=public --add-port=6443/tcp && sudo firewall-cmd --reload
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
As
user@microshift
, verify that MicroShift is running by entering the following command:oc get all -A
[user@microshift]$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.4.2. Accessing the MicroShift cluster remotely Copy linkLink copied to clipboard!
Use the following procedure to access the MicroShift cluster from a remote location by using a kubeconfig
file.
The user@workstation
login is used to access the host machine remotely. The <user>
value in the procedure is the name of the user that user@workstation
logs in with to the MicroShift host.
Prerequisites
-
You have installed the
oc
binary. -
The
user@microshift
has opened the firewall from the local host.
Procedure
As
user@workstation
, create a~/.kube/
folder if your Red Hat Enterprise Linux (RHEL) machine does not have one by running the following command:mkdir -p ~/.kube/
[user@workstation]$ mkdir -p ~/.kube/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow As
user@workstation
, set a variable for the hostname of your MicroShift host by running the following command:MICROSHIFT_MACHINE=<name or IP address of MicroShift machine>
[user@workstation]$ MICROSHIFT_MACHINE=<name or IP address of MicroShift machine>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow As
user@workstation
, copy the generatedkubeconfig
file that contains the host name or IP address you want to connect with from the RHEL machine running MicroShift to your local machine by running the following command:ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/config
[user@workstation]$ ssh <user>@$MICROSHIFT_MACHINE "sudo cat /var/lib/microshift/resources/kubeadmin/$MICROSHIFT_MACHINE/kubeconfig" > ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteTo generate the
kubeconfig
files for this step, see Generating additional kubeconfig files for remote access.As
user@workstation
, update the permissions on your~/.kube/config
file by running the following command:chmod go-r ~/.kube/config
$ chmod go-r ~/.kube/config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
As
user@workstation
, verify that MicroShift is running by entering the following command:oc get all -A
[user@workstation]$ oc get all -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 5. Configuring custom certificate authorities Copy linkLink copied to clipboard!
You can encrypt connections by using custom certificate authorities (CAs) with the MicroShift service.
5.1. How custom certificate authorities work in MicroShift Copy linkLink copied to clipboard!
The default API server certificate is issued by an internal MicroShift cluster certificate authority (CA). Clients outside of the cluster cannot verify the API server certificate by default. This certificate can be replaced by a custom server certificate that is issued externally by a custom CA that clients trust. The following steps illustrate the workflow in MicroShift:
- Copy the certificates and keys to the preferred directory in the host operating system. Ensure that the files are accessible by root only.
Update the MicroShift configuration for each custom CA by specifying the certificate names and new fully qualified domain name (FQDN) in the MicroShift
/etc/microshift/config.yaml
configuration file.Each certificate configuration can contain the following values:
- The certificate file location is a required value.
A single common name containing the API server DNS and IP address or IP address range.
TipIn most cases, MicroShift generates a new
kubeconfig
for your custom CA that includes the IP address or range that you specify. The exception is when wildcards are specified for the IP address. In this case, MicroShift generates akubeconfig
with the public IP address of the server. To use wildcards, you must update thekubeconfig
file with your specific details.- Multiple Subject Alternative Names (SANs) containing the API server DNS and IP addresses or a wildcard certificate.
- You can provide additional DNS names for each certificate.
-
After the MicroShift service restarts, you must copy the generated
kubeconfig
files to the client. - Configure additional CAs on the client system. For example, you can update CA bundles in the Red Hat Enterprise Linux (RHEL) truststore.
- The certificates and keys are read from the specified file location on the host. Testing and validation of configuration is done from the client.
- External server certificates are not automatically renewed. You must manually rotate your external certificates.
If any validation fails, the MicroShift service skips the custom configuration and uses the default certificate to start. The priority is to continue the service uninterrupted. MicroShift logs errors when the service starts. Common errors include expired certificates, missing files, or incorrect IP addresses.
Custom server certificates have to be validated against CA data configured in the trust root of the host operating system. For information, see The system-wide truststore.
5.2. Configuring custom certificate authorities Copy linkLink copied to clipboard!
To configure externally generated certificates and domain names using custom certificate authorities (CAs), add them to the MicroShift /etc/microshift/config.yaml
configuration file. You must also configure the host operating system trust root.
Externally generated kubeconfig
files are created in the /var/lib/microshift/resources/kubeadmin/<hostname>/kubeconfig
directory. If you need to use localhost
in addition to externally generated configurations, retain the original kubeconfig
file in its default location. The localhost
kubeconfig
file uses the self-signed certificate authority.
Prerequisites
-
The OpenShift CLI (
oc
) is installed. - You have access to the cluster as a user with the cluster administration role.
- The certificate authority has issued the custom certificates.
-
A MicroShift
/etc/microshift/config.yaml
configuration file exists.
Procedure
- Copy the custom certificates you want to add to the trust root of the MicroShift host. Ensure that the certificate and private keys are only accessible to MicroShift.
For each custom CA that you need, add an
apiServer
section callednamedCertificates
to the/etc/microshift/config.yaml
MicroShift configuration file by using the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the MicroShift to apply the certificates by running the following command:
systemctl microshift restart
$ systemctl microshift restart
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Wait a few minutes for the system to restart and apply the custom server. New
kubeconfig
files are generated in the/var/lib/microshift/resources/kubeadmin/
directory. -
Copy the
kubeconfig
files to the client. If you specified wildcards for the IP address, update thekubeconfig
to remove the public IP address of the server and replace that IP address with the specific wildcard range you want to use. From the client, use the following steps:
Specify the
kubeconfig
to use by running the following command:export KUBECONFIG=~/custom-kubeconfigs/kubeconfig
$ export KUBECONFIG=~/custom-kubeconfigs/kubeconfig
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Use the location of the copied
kubeconfig
file as the path.
Check that the certificates are applied by using the following command:
oc --certificate-authority ~/certs/ca.ca get node
$ oc --certificate-authority ~/certs/ca.ca get node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
oc get node NAME STATUS ROLES AGE VERSION dhcp-1-235-195.arm.example.com Ready control-plane,master,worker 76m v1.31.3
oc get node NAME STATUS ROLES AGE VERSION dhcp-1-235-195.arm.example.com Ready control-plane,master,worker 76m v1.31.3
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the new CA file to the $KUBECONFIG environment variable by running the following command:
oc config set clusters.microshift.certificate-authority /tmp/certificate-authority-data-new.crt
$ oc config set clusters.microshift.certificate-authority /tmp/certificate-authority-data-new.crt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the new
kubeconfig
file contains the new CA by running the following command:oc config view --flatten
$ oc config view --flatten
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example externally generated
kubeconfig
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
certificate-authority-data
section is not present in externally generatedkubeconfig
files. It is added with theoc config set
command used previously.
Verify the
subject
andissuer
of your customized API server certificate authority by running the following command:curl --cacert /tmp/caCert.pem https://${fqdn_name}:6443/healthz -v
$ curl --cacert /tmp/caCert.pem https://${fqdn_name}:6443/healthz -v
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantEither replace the
certificate-authority-data
in the generatedkubeconfig
file with the newrootCA
or add thecertificate-authority-data
to the trust root of the operating system. Do not use both methods.Configure additional CAs in the trust root of the operating system. For example, in the RHEL Client truststore on the client system. See The system-wide truststore for details.
- Updating the certificate bundle with the configuration that contains the CA is recommended.
-
If you do not want to configure your certificate bundles, you can alternately use the
oc login localhost:8443 --certificate-authority=/path/to/cert.crt
command, but this method is not preferred.
5.3. Custom certificates reserved name values Copy linkLink copied to clipboard!
The following certificate problems cause MicroShift to ignore certificates dynamically and log an error:
- The certificate files do not exist on the disk or are not readable.
- The certificate is not parsable.
-
The certificate overrides the internal certificates IP addresses or DNS names in a
SubjectAlternativeNames
(SAN) field. Do not use a reserved name when configuring SANs.
Address | Type | Comment |
---|---|---|
| DNS | |
| IP Address | |
| IP Address | Cluster Network |
| IP Address | Service Network |
169.254.169.2/29 | IP Address | br-ex Network |
| DNS | |
| DNS | |
| DNS |
5.4. Troubleshooting custom certificates Copy linkLink copied to clipboard!
To troubleshoot the implementation of custom certificates, you can take the following steps.
Procedure
From MicroShift, ensure that the certificate is served by the
kube-apiserver
and verify that the certificate path is appended to the--tls-sni-cert-key
FLAG by running the following command:journalctl -u microshift -b0 | grep tls-sni-cert-key
$ journalctl -u microshift -b0 | grep tls-sni-cert-key
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Jan 24 14:53:00 localhost.localdomain microshift[45313]: kube-apiserver I0124 14:53:00.649099 45313 flags.go:64] FLAG: --tls-sni-cert-key="[/home/eslutsky/dev/certs/server.crt,/home/eslutsky/dev/certs/server.key;/var/lib/microshift/certs/kube-apiserver-external-signer/kube-external-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-external-signer/kube-external-serving/server.key;/var/lib/microshift/certs/kube-apiserver-localhost-signer/kube-apiserver-localhost-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-localhost-signer/kube-apiserver-localhost-serving/server.key;/var/lib/microshift/certs/kube-apiserver-service-network-signer/kube-apiserver-service-network-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-service-network-signer/kube-apiserver-service-network-serving/server.key
Jan 24 14:53:00 localhost.localdomain microshift[45313]: kube-apiserver I0124 14:53:00.649099 45313 flags.go:64] FLAG: --tls-sni-cert-key="[/home/eslutsky/dev/certs/server.crt,/home/eslutsky/dev/certs/server.key;/var/lib/microshift/certs/kube-apiserver-external-signer/kube-external-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-external-signer/kube-external-serving/server.key;/var/lib/microshift/certs/kube-apiserver-localhost-signer/kube-apiserver-localhost-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-localhost-signer/kube-apiserver-localhost-serving/server.key;/var/lib/microshift/certs/kube-apiserver-service-network-signer/kube-apiserver-service-network-serving/server.crt,/var/lib/microshift/certs/kube-apiserver-service-network-signer/kube-apiserver-service-network-serving/server.key
Copy to Clipboard Copied! Toggle word wrap Toggle overflow From the client, ensure that the
kube-apiserver
is serving the correct certificate by running the following command:openssl s_client -connect <SNI_ADDRESS>:6443 -showcerts | openssl x509 -text -noout -in - | grep -C 1 "Alternative\|CN"
$ openssl s_client -connect <SNI_ADDRESS>:6443 -showcerts | openssl x509 -text -noout -in - | grep -C 1 "Alternative\|CN"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.5. Cleaning up and recreating the custom certificates Copy linkLink copied to clipboard!
To stop the MicroShift services, clean up the custom certificates and recreate the custom certificates, use the following steps.
Procedure
Stop the MicroShift services and clean up the custom certificates by running the following command:
sudo microshift-cleanup-data --cert
$ sudo microshift-cleanup-data --cert
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Stopping MicroShift services Removing MicroShift certificates MicroShift service was stopped Cleanup succeeded
Stopping MicroShift services Removing MicroShift certificates MicroShift service was stopped Cleanup succeeded
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the MicroShift services to recreate the custom certificates by running the following command:
sudo systemctl start microshift
$ sudo systemctl start microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.6. Additional resources Copy linkLink copied to clipboard!
Chapter 6. Checking greenboot scripts status Copy linkLink copied to clipboard!
To deploy applications or make other changes through the MicroShift API with tools other than kustomize
manifests, you must wait until the greenboot health checks have finished. This ensures that your changes are not lost if greenboot rolls your rpm-ostree
system back to an earlier state.
The greenboot-healthcheck
service runs one time and then exits. After greenboot has exited and the system is in a healthy state, you can proceed with configuration changes and deployments.
6.1. Checking the status of greenboot health checks Copy linkLink copied to clipboard!
Check the status of greenboot health checks before making changes to the system or during troubleshooting. You can use any of the following commands to help you ensure that greenboot scripts have finished running.
Procedure
To see a report of health check status, use the following command:
systemctl show --property=SubState --value greenboot-healthcheck.service
$ systemctl show --property=SubState --value greenboot-healthcheck.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
An output of
start
means that greenboot checks are still running. -
An output of
exited
means that checks have passed and greenboot has exited. Greenboot runs the scripts in thegreen.d
directory when the system is a healthy state. -
An output of
failed
means that checks have not passed. Greenboot runs the scripts inred.d
directory when the system is in this state and might restart the system.
-
An output of
To see a report showing the numerical exit code of the service where
0
means success and non-zero values mean a failure occurred, use the following command:systemctl show --property=ExecMainStatus --value greenboot-healthcheck.service
$ systemctl show --property=ExecMainStatus --value greenboot-healthcheck.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To see a report showing a message about boot status, such as
Boot Status is GREEN - Health Check SUCCESS
, use the following command:cat /run/motd.d/boot-status
$ cat /run/motd.d/boot-status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 7. Configuring audit logging policies Copy linkLink copied to clipboard!
You can control MicroShift audit log file rotation and retention by using configuration values.
7.1. About setting limits on audit log files Copy linkLink copied to clipboard!
Controlling the rotation and retention of the MicroShift audit log file by using configuration values helps keep the limited storage capacities of far-edge devices from being exceeded. On such devices, logging data accumulation can limit host system or cluster workloads, potentially causing the device stop working. Setting audit log policies can help ensure that critical processing space is continually available.
The values you set to limit MicroShift audit logs enable you to enforce the size, number, and age limits of audit log backups. Field values are processed independently of one another and without prioritization.
You can set fields in combination to define a maximum storage limit for retained logs. For example:
-
Set both
maxFileSize
andmaxFiles
to create a log storage upper limit. -
Set a
maxFileAge
value to automatically delete files older than the timestamp in the file name, regardless of themaxFiles
value.
7.1.1. Default audit log values Copy linkLink copied to clipboard!
MicroShift includes the following default audit log rotation values:
Audit log parameter | Default setting | Definition |
---|---|---|
|
| How long log files are retained before automatic deletion. The default value means that a log file is never deleted based on age. This value can be configured. |
|
| The total number of log files retained. By default, MicroShift retains 10 log files. The oldest is deleted when an excess file is created. This value can be configured. |
|
|
By default, when the |
|
|
The |
The maximum default storage usage for audit log retention is 2000Mb if there are 10 or fewer files.
If you do not specify a value for a field, the default value is used. If you remove a previously set field value, the default value is restored after the next MicroShift service restart.
You must configure audit log retention and rotation in Red Hat Enterprise Linux (RHEL) for logs that are generated by application pods. These logs print to the console and are saved. Ensure that your log preferences are configured for the RHEL /var/log/audit/audit.log
file to maintain MicroShift cluster health.
Additional resources
- Configuring auditd for a secure environment
- Understanding Audit log files
- How to use logrotate utility to rotate log files (Solutions, dated 7 August 2024)
7.2. About audit log policy profiles Copy linkLink copied to clipboard!
Audit log profiles define how to log requests that come to the OpenShift API server and the Kubernetes API server.
MicroShift supports the following predefined audit policy profiles:
Profile | Description |
---|---|
| Logs only metadata for read and write requests; does not log request bodies except for OAuth access token requests. This is the default policy. |
|
In addition to logging metadata for all requests, logs request bodies for every write request to the API servers ( |
|
In addition to logging metadata for all requests, logs request bodies for every read and write request to the API servers ( |
| No requests are logged, including OAuth access token requests and OAuth authorize token requests. Warning
Do not disable audit logging by using the |
-
Sensitive resources, such as
Secret
,Route
, andOAuthClient
objects, are only logged at the metadata level.
By default, MicroShift uses the Default
audit log profile. You can use another audit policy profile that also logs request bodies, but be aware of the increased resource usage such as CPU, memory, and I/O.
7.3. Configuring audit log values Copy linkLink copied to clipboard!
You can configure audit log settings by using the MicroShift service configuration file.
Procedure
-
Make a copy of the provided
config.yaml.default
file in the/etc/microshift/
directory, renaming itconfig.yaml
. Keep the new MicroShiftconfig.yaml
you create in the/etc/microshift/
directory. The newconfig.yaml
is read whenever the MicroShift service starts. After you create it, theconfig.yaml
file takes precedence over built-in settings. Replace the default values in the
auditLog
section of the YAML with your desired valid values.Example default
auditLog
configurationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specifies the maximum time in days that log files are kept. Files older than this limit are deleted. In this example, after a log file is more than 7 days old, it is deleted. The files are deleted regardless of whether or not the live log has reached the maximum file size specified in the
maxFileSize
field. File age is determined by the timestamp written in the name of the rotated log file, for example,audit-2024-05-16T17-03-59.994.log
. When the value is0
, the limit is disabled. - 2
- The maximum audit log file size in megabytes. In this example, the file is rotated as soon as the live log reaches the 200 MB limit. When the value is set to
0
, the limit is disabled. - 3
- The maximum number of rotated audit log files retained. After the limit is reached, the log files are deleted in order from oldest to newest. In this example, the value
1
results in only 1 file of sizemaxFileSize
being retained in addition to the current active log. When the value is set to0
, the limit is disabled. - 4
- Logs only metadata for read and write requests; does not log request bodies except for OAuth access token requests. If you do not specify this field, the
Default
profile is used.
Optional: To specify a new directory for logs, you can stop MicroShift, and then move the
/var/log/kube-apiserver
directory to your desired location:Stop MicroShift by running the following command:
sudo systemctl stop microshift
$ sudo systemctl stop microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the
/var/log/kube-apiserver
directory to your desired location by running the following command:sudo mv /var/log/kube-apiserver <~/kube-apiserver>
$ sudo mv /var/log/kube-apiserver <~/kube-apiserver>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<~/kube-apiserver>
with the path to the directory that you want to use.
If you specified a new directory for logs, create a symlink to your custom directory at
/var/log/kube-apiserver
by running the following command:sudo ln -s <~/kube-apiserver> /var/log/kube-apiserver
$ sudo ln -s <~/kube-apiserver> /var/log/kube-apiserver
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
<~/kube-apiserver>
with the path to the directory that you want to use. This enables the collection of logs in sos reports.
If you are configuring audit log policies on a running instance, restart MicroShift by entering the following command:
sudo systemctl restart microshift
$ sudo systemctl restart microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.4. Troubleshooting audit log configuration Copy linkLink copied to clipboard!
Use the following steps to troubleshoot custom audit log settings and file locations.
Procedure
Check the current values that are configured by running the following command:
sudo microshift show-config --mode effective
$ sudo microshift show-config --mode effective
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
auditLog: maxFileSize: 200 maxFiles: 1 maxFileAge: 7 profile: AllRequestBodies
auditLog: maxFileSize: 200 maxFiles: 1 maxFileAge: 7 profile: AllRequestBodies
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the
audit.log
file permissions by running the following command:sudo ls -ltrh /var/log/kube-apiserver/audit.log
$ sudo ls -ltrh /var/log/kube-apiserver/audit.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
-rw-------. 1 root root 46M Mar 12 09:52 /var/log/kube-apiserver/audit.log
-rw-------. 1 root root 46M Mar 12 09:52 /var/log/kube-apiserver/audit.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List the contents of the current log directory by running the following command:
sudo ls -ltrh /var/log/kube-apiserver/
$ sudo ls -ltrh /var/log/kube-apiserver/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
total 6.0M -rw-------. 1 root root 2.0M Mar 12 10:56 audit-2024-03-12T14-56-16.267.log -rw-------. 1 root root 2.0M Mar 12 10:56 audit-2024-03-12T14-56-49.444.log -rw-------. 1 root root 962K Mar 12 10:57 audit.log
total 6.0M -rw-------. 1 root root 2.0M Mar 12 10:56 audit-2024-03-12T14-56-16.267.log -rw-------. 1 root root 2.0M Mar 12 10:56 audit-2024-03-12T14-56-49.444.log -rw-------. 1 root root 962K Mar 12 10:57 audit.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 8. Disabling the LVMS CSI provider or CSI snapshot Copy linkLink copied to clipboard!
You can configure MicroShift to disable the built-in logical volume manager storage (LVMS) Container Storage Interface (CSI) provider or the CSI snapshot capabilities to reduce the use of runtime resources such as RAM, CPU, and storage.
8.1. Disabling deployments that run CSI snapshot implementations Copy linkLink copied to clipboard!
Use the following procedure to disable installation of the CSI implementation pods.
This procedure is for users who are defining the configuration file before installing and running MicroShift. If MicroShift is already started then CSI snapshot implementation will be running. Users must manually remove it by following the uninstallation instructions.
MicroShift will not delete CSI snapshot implementation pods. You must configure MicroShift to disable installation of the CSI snapshot implementation pods during the startup process.
Procedure
Disable installation of the CSI snapshot controller by entering the
optionalCsiComponents
value under thestorage
section of the MicroShift configuration file in/etc/microshift/config.yaml
:# ... storage: {} # ...
# ... storage: {}
1 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Accepted values are:
-
Not defining
optionalCsiComponents
. -
Specifying
optionalCsiComponents
field with an empty value ([]
) or a single empty string element ([""]
). Specifying
optionalCsiComponents
with one of the accepted values which aresnapshot-controller
, ornone
. A value ofnone
is mutually exclusive with all other values.NoteIf the
optionalCsiComponents
value is empty or null, MicroShift defaults to deploying snapshot-controller.
-
Not defining
After the
optionalCsiComponents
field is specified with a supported value in theconfig.yaml
, start MicroShift by running the following command:sudo systemctl start microshift
$ sudo systemctl start microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteMicroShift does not redeploy the disabled components after a restart.
8.2. Disabling deployments that run the CSI driver implementations Copy linkLink copied to clipboard!
Use the following procedure to disable installation of the CSI implementation pods.
This procedure is for users who are defining the configuration file before installing and running MicroShift. If MicroShift is already started then CSI driver implementation will be running. Users must manually remove it by following the uninstallation instructions.
MicroShift will not delete CSI driver implementation pods. You must configure MicroShift to disable installation of the CSI driver implementation pods during the startup process.
Procedure
Disable installation of the CSI driver by entering the
driver
value under thestorage
section of the MicroShift configuration file in/etc/microshift/config.yaml
:# ... storage driver: - "none" # ...
# ... storage driver: - "none"
1 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Valid values are
none
orlvms
.
NoteBy default, the
driver
value is empty or null and LVMS is deployed.Start MicroShift after the
driver
field is specified with a supported value in the/etc/microshift/config.yaml
file by running the following command:sudo systemctl enable --now microshift
$ sudo systemctl enable --now microshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteMicroShift does not redeploy the disabled components after a restart operation.
Chapter 9. Configuring low latency Copy linkLink copied to clipboard!
9.1. Configuring low latency Copy linkLink copied to clipboard!
You can configure and tune low latency capabilities to improve application performance on edge devices.
9.1.1. Lowering latency in MicroShift applications Copy linkLink copied to clipboard!
Latency is defined as the time from an event to the response to that event. You can use low latency configurations and tuning in a MicroShift cluster running in an operational or software-defined control system where an edge device has to respond quickly to an external event. You can fully optimize low latency performance by combining MicroShift configurations with operating system tuning and workload partitioning.
The CPU set for management applications, such as the MicroShift service, OVS, CRI-O, MicroShift pods, and isolated cores, must contain all-online CPUs.
9.1.1.1. Workflow for configuring low latency for MicroShift applications Copy linkLink copied to clipboard!
To configure low latency for applications running in a MicroShift cluster, you must complete the following tasks:
- Required
-
Install the
microshift-low-latency
RPM. - Configure workload partitioning.
-
Configure the
kubelet
section of theconfig.yaml
file in the/etc/microshift/
directory. - Configure and activate a TuneD profile. TuneD is a Red Hat Enterprise Linux (RHEL) service that monitors the host system and optimizes performance under certain workloads.
- Restart the host.
-
Install the
- Optional
- If you are using the x86_64 architecture, you can install Red Hat Enterprise Linux for Real Time 9.
9.1.2. Installing the MicroShift low latency RPM package Copy linkLink copied to clipboard!
When you install MicroShift, the low latency RPM package is not installed by default. You can install the low latency RPM as an optional package.
Prerequisites
- You installed the MicroShift RPM.
- You configured workload partitioning for MicroShift.
Procedure
Install the low latency RPM package by running the following command:
sudo dnf install -y microshift-low-latency
$ sudo dnf install -y microshift-low-latency
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipWait to restart the host until after activating your TuneD profile. Restarting the host restarts MicroShift and CRI-O, which applies the low latency manifests and activates the TuneD profile.
Next steps
-
Configure the kubelet parameter for low latency in the MicroShift
config.yaml
. - Tune your operating system, for example, configure and activate a TuneD profile.
- Optional: Configure automatic activation of your TuneD profile.
- Optional: If you are using the x86_64 architecture, install Red Hat Enterprise Linux for Real Time (real-time kernel).
- Prepare your workloads for low latency.
9.1.3. Configuration kubelet parameters and values in MicroShift Copy linkLink copied to clipboard!
The first step in enabling low latency to a MicroShift cluster is to add configurations to the MicroShift config.yaml
file.
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You have root access to the cluster.
-
You made a copy of the provided
config.yaml.default
file in the/etc/microshift/
directory, and renamed itconfig.yaml
.
Procedure
Add the kubelet configuration to the MicroShift
config.yaml
file:Example passthrough
kubelet
configurationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If you change the CPU or memory managers in the kubelet configuration, you must remove files that cache the previous configuration. Restart the host to remove them automatically, or manually remove the
/var/lib/kubelet/cpu_manager_state
and/var/lib/kubelet/memory_manager_state
files. - 2
- The name of the policy to use. Valid values are
none
andstatic
. Requires theCPUManager
feature gate to be enabled. Default value isnone
. - 3
- A set of
key=value
pairs for setting extra options that fine tune the behavior of theCPUManager
policies. The default value isnull
. Requires both theCPUManager
andCPUManagerPolicyOptions
feature gates to be enabled. - 4
- The name of the policy used by Memory Manager. Case-sensitive. The default value is
none
. Requires theMemoryManager
feature gate to be enabled. - 5
- Required. The
reservedSystemCPUs
value must be the inverse of the offlined CPUs because both values combined must account for all of the CPUs on the system. This parameter is essential to dividing the management and application workloads. Use this parameter to define a static CPU set for the host-level system and Kubernetes daemons, plus interrupts and timers. Then the rest of the CPUs on the system can be used exclusively for workloads. - 6
- The value in
reservedMemory[0].limits.memory
,1100
Mi in this example, is equal tokubeReserved.memory
+systemReserved.memory
+evictionHard.memory.available
. - 7
- The
evictionHard
parameters define under which conditions the kubelet evicts pods. When you change the default value of only one parameter for theevictionHard
stanza, the default values of other parameters are not inherited and are set to zero. Provide all the threshold values even when you want to change just one. - 8
- The
imagefs
is a filesystem that container runtimes use to store container images and container writable layers. In this example, theevictionHard.imagefs.available
parameter means that the pod is evicted when the available space of the image filesystem is less than 15%. - 9
- In this example, the
evictionHard.memory.available
parameter means that the pods are evicted when the available memory of the node drops below 100MiB. - 10
- In this example, the
evictionHard.nodefs.available
parameter means that the pods are evicted when the main filesystem of the node has less than 10% available space. - 11
- In this example, the
evictionHard.nodefs.inodesFree
parameter means that the pods are evicted when more than 15% of the node’s main filesystem’s inodes are in use. - 12
- For container garbage collection: The duration to wait before transitioning out of an eviction pressure condition. Setting the
evictionPressureTransitionPeriod
parameter to0
configures the default value of 5 minutes.
Verification
-
After you complete the next steps and restart the host, you can use a root-access account to check that your settings are in the
config.yaml
file in the/var/lib/microshift/resources/kubelet/config/
directory.
Next steps
- Enable workload partitioning.
- Tune your operating system. For example, configure and activate a TuneD profile.
- Optional: Configure automatic enablement of your TuneD profile.
- Optional: If you are using the x86_64 architecture, you can install Red Hat Enterprise Linux for Real Time (real-time kernel).
- Prepare your MicroShift workloads for low latency.
9.1.4. Tuning Red Hat Enterprise Linux 9 Copy linkLink copied to clipboard!
As a Red Hat Enterprise Linux (RHEL) system administrator, you can use the TuneD service to optimize the performance profile of RHEL for a variety of use cases. TuneD monitors and optimizes system performance under certain workloads, including latency performance.
- Use TuneD profiles to tune your system for different use cases, such as deploying a low-latency MicroShift cluster.
- You can modify the rules defined for each profile and customize tuning for a specific device.
- When you switch to another profile or deactivate TuneD, all changes made to the system settings by the previous profile revert back to their original state.
- You can also configure TuneD to react to changes in device usage and adjusts settings to improve performance of active devices and reduce power consumption of inactive devices.
9.1.4.1. Configuring the MicroShift TuneD profile Copy linkLink copied to clipboard!
Configure a TuneD profile for your host to use low latency with MicroShift workloads using the microshift-baseline-variables.conf
configuration file provided in the Red Hat Enterprise Linux (RHEL) /etc/tuned/
host directory after you install the microshift-low-latency
RPM package.
Prerequisites
- You have root access to the cluster.
-
You installed the
microshift-low-latency
RPM package. - Your RHEL host has TuneD installed. See Getting started with TuneD (RHEL documentation).
Procedure
You can use the default
microshift-baseline-variables.conf
TuneD profile in the/etc/tuned/
directory profile, or create your own to add more tunings.Example
microshift-baseline-variables.conf
TuneD profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Controls which cores should be isolated. By default, 1 core per socket is reserved in MicroShift for housekeeping. The other cores are isolated. Valid values are a core list or range. You can isolate any range, for example:
isolated_cores=2,4-7
orisolated_cores=2-23
.ImportantYou must keep only one
isolated_cores=
variable.NoteThe Kubernetes CPU manager can use any CPU to run the workload except the reserved CPUs defined in the kubelet configuration. For this reason it is best that:
- The sum of the kubelet’s reserved CPUs and isolated cores include all online CPUs.
- Isolated cores are complementary to the reserved CPUs defined in the kubelet configuration.
- 2
- Size of the hugepages. Valid values are 2M or 1G.
- 3
- Additional kernel arguments, for example,
additional_args=console=tty0 console=ttyS0,115200
. - 4
- The CPU set to be offlined.Important
Must not overlap with
isolated_cores
.
Enable the profile or make changes active, by running the following command:
sudo tuned-adm profile microshift-baseline
$ sudo tuned-adm profile microshift-baseline
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reboot the host to make kernel arguments active.
Verification
Optional: You can read the
/proc/cmdline
file that contains the arguments given to the currently running kernel on start.cat /proc/cmdline
$ cat /proc/cmdline
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
BOOT_IMAGE=(hd0,msdos2)/ostree/rhel-7f82ccd9595c3c70af16525470e32c6a81c9138c4eae6c79ab86d5a2d108d7fc/vmlinuz-5.14.0-427.31.1.el9_4.x86_64+rt crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.lvm.lv=rhel/root fips=0 console=ttyS0,115200n8 root=/dev/mapper/rhel-root rw ostree=/ostree/boot.1/rhel/7f82ccd9595c3c70af16525470e32c6a81c9138c4eae6c79ab86d5a2d108d7fc/0 skew_tick=1 tsc=reliable rcupdate.rcu_normal_after_boot=1 nohz=on nohz_full=2,4-5 rcu_nocbs=2,4-5 tuned.non_isolcpus=0000000b intel_pstate=disable nosoftlockup hugepagesz=2M hugepages=10
BOOT_IMAGE=(hd0,msdos2)/ostree/rhel-7f82ccd9595c3c70af16525470e32c6a81c9138c4eae6c79ab86d5a2d108d7fc/vmlinuz-5.14.0-427.31.1.el9_4.x86_64+rt crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M rd.lvm.lv=rhel/root fips=0 console=ttyS0,115200n8 root=/dev/mapper/rhel-root rw ostree=/ostree/boot.1/rhel/7f82ccd9595c3c70af16525470e32c6a81c9138c4eae6c79ab86d5a2d108d7fc/0 skew_tick=1 tsc=reliable rcupdate.rcu_normal_after_boot=1 nohz=on nohz_full=2,4-5 rcu_nocbs=2,4-5 tuned.non_isolcpus=0000000b intel_pstate=disable nosoftlockup hugepagesz=2M hugepages=10
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
- Prepare your MicroShift workloads for low latency.
- Optional: Configure automatic enablement of your TuneD profile.
- Optional: If you are using the x86_64 architecture, you can install Red Hat Enterprise Linux for Real Time (real-time kernel).
9.1.4.2. Automatically enable the MicroShift TuneD profile Copy linkLink copied to clipboard!
Included in the microshift-low-latency
RPM package is a systemd service that you can configure to automatically enable a TuneD profile when the system starts. This ability is particularly useful if you are installing MicroShift in a large fleet of devices.
Prerequisites
- You installed the microshift-low-latency RPM package on the host.
-
You enabled low latency in the MicroShift
config.yaml
. - You created a TuneD profile.
-
You configured the
microshift-baseline-variables.conf
file.
Procedure
Configure the
tuned.yaml
in the/etc/microshift/
directory, for example:Example tuned.yaml
profile: microshift-baseline reboot_after_apply: True
profile: microshift-baseline
1 reboot_after_apply: True
2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Controls which TuneD profile is activated. In this example, the name of the profile is
microshift-baseline
. - 2
- Controls whether the host must be rebooted after applying the profile. Valid values are
True
andFalse
. For example, use theTrue
setting to automatically restart the host after a newostree
commit is deployed.
ImportantThe host is restarted when the
microshift-tuned.service
runs, but it does not restart the system when a new commit is deployed. You must restart the host to enable a new commit, then the system starts again when themicroshift-tuned.service
runs on that boot and detects changes to profiles and variables.This double-boot can effect rollbacks. Ensure that you adjust the number of reboots in greenboot that are allowed before rollback when using automatic profile activation. For example, if 3 reboots are allowed before a rollback in greenboot, increase that number to 4. See the "Additional resources" list for more information.
Enable the
microshift-tuned.service
to run on each system start by entering the following command:sudo systemctl enable microshift-tuned.service
$ sudo systemctl enable microshift-tuned.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIf you set
reboot_after_apply
toTrue
, ensure that a TuneD profile is active and that no other profiles have been activated outside of the MicroShift service. Otherwise, starting themicroshift-tuned.service
results in a host reboot.Start the
microshift-tuned.service
by running the following command:sudo systemctl start microshift-tuned.service
$ sudo systemctl start microshift-tuned.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
microshift-tuned.service
uses collected checksums to detect changes to selected TuneD profiles and variables. If there are no checksums on the disk, the service activates the TuneD profile and restarts the host. Expect a host restart when first starting themicroshift-tuned.service
.
Next steps
- Optional: If you are using the x86_64 architecture, you can install Red Hat Enterprise Linux for Real Time (real-time kernel).
9.1.5. Using Red Hat Enterprise Linux for Real Time Copy linkLink copied to clipboard!
If your workload has stringent low-latency determinism requirements for core kernel features such as interrupt handling and process scheduling in the microsecond (μs) range, you can use the Red Hat Enterprise Linux for Real Time (real-time kernel). The goal of the real-time kernel is consistent, low-latency determinism that offers predictable response times.
When considering system tuning, consider the following factors:
- System tuning is just as important when using the real-time kernel as it is for the standard kernel.
- Installing the real-time kernel on an untuned system running the standard kernel supplied as part of the RHEL 9 release is not likely to result in any noticeable benefit.
- Tuning the standard kernel yields 90% of possible latency gains.
- The real-time kernel provides the last 10% of latency reduction required by the most demanding workloads.
9.1.5.1. Installing the Red Hat Enterprise Linux for Real Time (real-time kernel) Copy linkLink copied to clipboard!
Although the real-time kernel is not necessary for low latency workloads, using the real-time kernel can optimize low latency performance. You can install it on a host using RPM packages, and include it in a Red Hat Enterprise Linux for Edge (RHEL for Edge) image deployment.
Prerequisites
- You have a Red Hat subscription that includes Red Hat Enterprise Linux for Real Time (real-time kernel). For example, your host machine is registered and Red Hat Enterprise Linux (RHEL) is attached to a RHEL for Real Time subscription.
- You are using x86_64 architecture.
Procedure
Enable the real-time kernel repository by running the following command:
sudo subscription-manager repos --enable rhel-9-for-x86_64-rt-rpms
$ sudo subscription-manager repos --enable rhel-9-for-x86_64-rt-rpms
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the real-time kernel by running the following command:
sudo dnf install -y kernel-rt
$ sudo dnf install -y kernel-rt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Query the real-time kernel version by running the following command:
RTVER=$(rpm -q --queryformat '%{version}-%{release}.%{arch}' kernel-rt | sort | tail -1)
$ RTVER=$(rpm -q --queryformat '%{version}-%{release}.%{arch}' kernel-rt | sort | tail -1)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Make a persistent change in GRUB that designates the real-time kernel as the default kernel by running the following command:
sudo grubby --set-default="/boot/vmlinuz-${RTVER}+rt"
$ sudo grubby --set-default="/boot/vmlinuz-${RTVER}+rt"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the host to activate the real-time kernel.
Next steps
- Prepare your MicroShift workloads for low latency.
- Optional: Use a blueprint to install the real-time kernel in a RHEL for Edge image.
You can include the real-time kernel in a RHEL for Edge image deployment using image builder. The following example blueprint sections include references gathered from the previous steps required to configure low latency for a MicroShift cluster.
Prerequisites
- You have a Red Hat subscription enabled on the host that includes Red Hat Enterprise Linux for Real Time (real-time kernel).
- You are using the x86_64 architecture.
-
You configured
osbuild
to use thekernel-rt
repository.
A subscription that includes the real-time kernel must be enabled on the host used to build the commit.
Procedure
Add the following example blueprint sections to your complete installation blueprint for installing the real-time kernel in a RHEL for Edge image:
Example blueprint snippet for the real-time kernel
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
- Complete the image building process.
- If you have not completed the previous steps for enabling low latency for your MicroShift cluster, do so now. Update the blueprint with the information gathered in those steps.
- If you have not configured workload partitioning, do so now.
- Prepare your MicroShift workloads for low latency.
9.1.6. Building the Red Hat Enterprise Linux for Edge (RHEL for Edge) image with the real-time kernel Copy linkLink copied to clipboard!
Complete the build process by starting with the following procedure to embed MicroShiftin a RHEL for Edge image. Then complete the remaining steps in the installation documentation for installing MicroShift in a RHEL for Edge image:
9.1.7. Preparing a MicroShift workload for low latency Copy linkLink copied to clipboard!
To take advantage of low latency, workloads running on MicroShift must have the microshift-low-latency
container runtime configuration set by using the RuntimeClass
feature. The CRI-O RuntimeClass
object is installed with the microshift-low-latency
RPM, so only the pod annotations need to be configured.
Prerequisites
-
You installed the
microshift-low-latency
RPM package. - You configured workload partitioning.
Procedure
Use the following example to set the following annotations in the pod spec:
cpu-load-balancing.crio.io: "disable" irq-load-balancing.crio.io: "disable" cpu-quota.crio.io: "disable" cpu-load-balancing.crio.io: "disable" cpu-freq-governor.crio.io: "<governor>"
cpu-load-balancing.crio.io: "disable" irq-load-balancing.crio.io: "disable" cpu-quota.crio.io: "disable" cpu-load-balancing.crio.io: "disable" cpu-freq-governor.crio.io: "<governor>"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example pod that runs
oslat
test:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Disables the CPU load balancing for the pod.
- 2
- Opts the pod out of interrupt handling (IRQ).
- 3
- Disables the CPU completely fair scheduler (CFS) quota at the pod run time.
- 4
- Enables or disables C-states for each CPU. Set the value to
disable
to provide the best performance for a high-priority pod. - 5
- Sets the
cpufreq
governor for each CPU. Theperformance
governor is recommended for high-priority workloads. - 6
- The
runtimeClassName
must match the name of the performance profile configured in the cluster. For example,microshift-low-latency
.
NoteDisable CPU load balancing only when the CPU manager static policy is enabled and for pods with guaranteed QoS that use whole CPUs. Otherwise, disabling CPU load balancing can affect the performance of other containers in the cluster.
ImportantFor the pod to have the
Guaranteed
QoS class, it must have the same values of CPU and memory in requests and limits. See Guaranteed (Kubernetes upstream documentation)
9.1.8. Reference blueprint for installing Red Hat Enterprise Linux for Real Time (real-time kernel) in a RHEL for Edge image Copy linkLink copied to clipboard!
An image blueprint is a persistent definition of the required image customizations that enable you to create multiple builds. Instead of reconfiguring the blueprint for each image build, you can edit, rebuild, delete, and save the blueprint so that you can keep rebuilding images from it.
Example blueprint used to install the real-time kernel in a RHEL for Edge image
9.2. Workload partitioning Copy linkLink copied to clipboard!
Workload partitioning divides the node CPU resources into distinct CPU sets. The primary objective is to limit the amount of CPU usage for all control plane components which reserves rest of the device CPU resources for workloads of the user.
Workload partitioning allocates reserved set of CPUs to MicroShift services, cluster management workloads, and infrastructure pods, ensuring that the remaining CPUs in the cluster deployment are untouched and available exclusively for non-platform workloads.
9.2.1. Enabling workload partitioning Copy linkLink copied to clipboard!
To enable workload partitioning on MicroShift, make the following configuration changes:
-
Update the MicroShift
config.yaml
file to include the kubelet configuration file. - Create the CRI-O systemd and configuration files.
- Create and update the systemd configuration file for the MicroShift and CRI-O services respectively.
Procedure
Update the MicroShift
config.yaml
file to include the kubelet configuration file to enable and configure CPU Manager for the workloads:Create the kubelet configuration file in the path
/etc/kubernetes/openshift-workload-pinning
. The kubelet configuration directs the kubelet to modify the node resources based on the capacity and allocatable CPUs.kubelet configuration example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
cpuset
applies to a machine with 8 VCPUs (4 cores) and is valid throughout the document.
Update the MicroShift config.yaml file in the path
/etc/microshift/config.yaml
. Embed the kubelet configuration in the MicroShiftconfig.yaml
file to enable and configure CPU Manager for the workloads.MicroShift
config.yaml
exampleCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Create the CRI-O systemd and configuration files:
Create the CRI-O configuration file in the path
/etc/crio/crio.conf.d/20-microshift-workload-partition.conf
which overrides the default configuration that already exists in the11-microshift-ovn.conf
file.CRI-O configuration example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the systemd file for CRI-O in the path
/etc/systemd/system/crio.service.d/microshift-cpuaffinity.conf
.CRI-O systemd configuration example
# ... [Service] CPUAffinity=0,6,7 # ...
# ... [Service] CPUAffinity=0,6,7 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create and update the systemd configuration file with
CPUAffinity
value for the MicroShift and CRI-O services:Create the MicroShift services systemd file in the path
/etc/systemd/system/microshift.service.d/microshift-cpuaffinity.conf
. MicroShift will be pinned using the systemdCPUAffinity
value.MicroShift services systemd configuration example
# ... [Service] CPUAffinity=0,6,7 # ...
# ... [Service] CPUAffinity=0,6,7 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
CPUAffinity
value in the MicroShift ovs-vswitchd systemd file in the path/etc/systemd/system/ovs-vswitchd.service.d/microshift-cpuaffinity.conf
.MicroShift ovs-vswitchd systemd configuration example
# ... [Service] CPUAffinity=0,6,7 # ...
# ... [Service] CPUAffinity=0,6,7 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
CPUAffinity
value in the MicroShift ovsdb-server systemd file in the path/etc/systemd/system/ovsdb-server.service.d/microshift-cpuaffinity.conf
MicroShift ovsdb-server systemd configuration example
# ... [Service] CPUAffinity=0,6,7 # ...
# ... [Service] CPUAffinity=0,6,7 # ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow