CoreWeave
Search…
Configuring a Linux image sourced from CoreWeave Cloud
Objective: Use our Packer Virtual Server to configure a Linux image from CoreWeave Cloud. Overview: Combining examples from Configuring a Windows Image sourced from CoreWeave Cloud and Configuring an externally sourced cloud Linux image, we will use our Packer Worker Virtual Server to configure a Linux image sourced from CoreWeave Cloud.

References:

centos.json
1KB
Binary

Selecting a source image

Following the example in Copying CoreWeave Images to a Writeable PVC, we will search for the latest CentOS image in the vd-images namespace:
We will then clone this image into our namespace:
YAML
volume_clone.yaml
1
apiVersion: cdi.kubevirt.io/v1beta1
2
kind: DataVolume
3
metadata:
4
annotations:
5
labels:
6
name: centos7-docker-master-clone-20210813-ord1
7
namespace: tenant-<name>
8
spec:
9
pvc:
10
accessModes:
11
- ReadWriteOnce
12
resources:
13
requests:
14
storage: 40Gi
15
storageClassName: block-nvme-ord1
16
volumeMode: Block
17
source:
18
pvc:
19
name: centos7-docker-master-20210813-ord1
20
namespace: vd-images
Copied!

Setting up the Packer Environment

Following the example in Creating a Packer Worker Virtual Server, we'll mount our CentOS PVC as an additional disk:
YAML
packer_vs.yaml
1
additionalDisks:
2
- name: CentOS_7
3
spec:
4
persistentVolumeClaim:
5
claimName: centos7-docker-master-clone-20210813-ord1
Copied!

Configuring the Packer manifest

Our Packer manifest will be a combination of our previous Windows and Ubuntu examples:
JavaScript
centos.json
1
{
2
"builders": [
3
{
4
"type": "qemu",
5
"accelerator": "kvm",
6
"communicator": "ssh",
7
"headless": true,
8
"disk_image": false,
9
"cpus": "6",
10
"memory": "16384",
11
"format": "raw",
12
"iso_checksum": "none",
13
"iso_url": "/dev/vdb",
14
"skip_resize_disk": false,
15
"skip_compaction": false,
16
"disk_size": "40000M",
17
"qemuargs": [
18
["-machine","pc-q35-4.2,accel=kvm,usb=off,vmport=off,dump-guest-core=off"],
19
["-cpu", "host"],
20
[ "-smp", "cpus=4,sockets=1" ],
21
[ "-cdrom", "cidata.iso" ],
22
["-drive", "file=/dev/vdb"]
23
],
24
"ssh_username": "user",
25
"ssh_password": "packer",
26
"net_device": "virtio-net",
27
"shutdown_command": "sudo shutdown --poweroff --no-wall now"
28
}
29
],
30
"provisioners": [
31
{
32
"type": "shell",
33
"execute_command": "{{.Vars}} sudo -S -E bash '{{.Path}}'",
34
"inline": [
35
"yum update -y",
36
"yum upgrade -y",
37
"yum clean all -y"
38
]
39
}
40
]
41
}
Copied!
/dev/vdb refers to our cloned block device
The credentials in this configuration are created when the VM reads the image output of create-ci-data.sh
In this example, we are using the shell provisioner to install package updates. To learn more and view more provisioners, view Hashicorp's documentation.

Execute Packer docker image

Similar to our Windows example, we'll kick off our CentOS build with launch-docker.sh win.json. Since we're writing to our PVC directly, all changes are made directly to our cloned disk.
Last modified 2mo ago