2.5. Automated pre-configuration¶
If you installed Host Network Accelerator as a new system, it includes a Day-1 configuration mechanism that starts a DHCP client on the first interface and enables a SSH server on it, so that the user can remotely access the console. This mechanism relies on cloud-init and can be customized as described in the following sections.
2.5.1. Day-1 configuration¶
At Host Network Accelerator startup, the Day-1 configuration is applied if one of the following file is present on the system:
/etc/init-config/config.cli
: this file can contain a list of CLI commands to be executed at startup./etc/init-config/config.json
: this file can contain a configuration in JSON format.
On success, the configuration is copied to the startup configuration and becomes persistent.
Note
If both files are present, /etc/init-config/config.cli
is
applied first, then /etc/init-config/config.json
.
Note
In previous versions, /etc/init-config.*
was used instead of
/etc/init-config/config.*
. The old path is deprecated, and its
processing will be removed in a future version. If both new path and
old path are present, only the new path is processed.
2.5.2. Initial configuration for CNF using Docker¶
To specify an initial configuration file to the Host Network Accelerator container with docker, use the following argument:
-v /path/to/local/init-config.cli:/etc/init-config/config.cli:ro
2.5.3. Initial configuration for CNF using Kubernetes¶
To pass an initial configuration file to the container in Kubernetes, you can use a ConfigMap.
Add the following content to the deployment file:
apiVersion: v1
kind: ConfigMap
metadata:
name: vsr-init-config
data:
vsr_init_config: |
/ system license online serial xxx
/ vrf main ssh-server enabled true
---
(...)
volumeMounts:
- mountPath: /etc/init-config/config.cli
subPath: vsr_init_config
name: init-config
(...)
volumes:
- name: init-config
configMap:
name: vsr-init-config
defaultMode: 0400
(...)
An alternative is to use an Init Container to generate the
/etc/init-config/config.cli
or /etc/init-config/config.json
file
inside the container. This option is more powerful because it is
possible to generate a different configuration for each pod.
2.5.4. Examples of Day-1 configuration for the CNF¶
Here are examples of files that can be provided to the Host Network Accelerator container to provide the initial configuration.
Example in text format (/etc/init-config/config.cli
)¶
/ vrf main interface physical pub1 port pci-b0s5
/ vrf main interface physical pub1 ipv4 dhcp enabled
/ system fast-path port pci-b0s5
/ system license online serial xxx
Example in JSON format (/etc/init-config/config.json
)¶
{
"vrouter:config": {
"vrf": [
{
"name": "main",
"vrouter-interface:interface": {
"physical": [
{
"name": "pub1",
"port": "pci-b0s5",
"ipv4": {
"dhcp": {
"enabled": true
}
}
}
]
}
}
],
"vrouter-system:system": {
"vrouter-fast-path:fast-path": {
"port": [
"pci-b0s5"
]
},
"vrouter-license:license": {
"online": {
"serial": "xxx"
}
}
}
}
}