Machine Config¶
Machine Config Operator Documentation
Creating a Machine Configuration File¶
-
Base64 encode the content for inclusion in a MachineConfig:
-
Place the encoded value after
base64,in the MachineConfig:apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: name: 99-worker-example labels: machineconfiguration.openshift.io/role: worker spec: config: ignition: version: 3.5.0 storage: files: - path: /etc/file.conf mode: 0644 overwrite: true contents: source: data:text/plain;charset=utf-8;base64,bXlzZWNyZXR2YWx1ZQ== -
Apply:
Use a File¶
CONTENT=$(base64 -w0 /path/to/myfile.conf)
cat <<EOF
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: 99-worker-myfile
spec:
config:
ignition:
version: 3.5.0
storage:
files:
- path: /etc/myfile.conf
mode: 0644
overwrite: true
contents:
source: data:text/plain;base64,${CONTENT}
EOF
To decode/verify:
Creating a Machine Configuration File with Butane¶
Butane transpiles human-readable configs into MachineConfig resources, avoiding manual base64 encoding.
-
Install Butane:
-
Write a Butane config — create
99-worker-example.bu: -
Transpile to MachineConfig:
-
Apply:
Using a Local File¶
Instead of inline, reference a local file: