sed-i
(Leon)
1
Manual setup
See Juju | Development Setup
LXD profile
See gist by @rbarry.
Locally, in a VM
Multipass has the charm-dev
blueprint which will create a VM with a juju controller ready to go:
multipass launch charm-dev
Alternatively, you could use version-pinned cloud-init scripts, for example:
multipass launch
--cloud-init https://raw.githubusercontent.com/Abuelodelanada/charm-dev-utils/main/cloud-init/charm-dev-juju-3.0.yaml
With multipass it is very easy to create disposable instances of different sizes. For example, to mimic the default github runner,
multipass launch
--cloud-init https://raw.githubusercontent.com/Abuelodelanada/charm-dev-utils/main/cloud-init/charm-dev-juju-3.0.yaml \
--name charm-dev-2cpu-7g \
--mem 7G \
--cpus 2 \
--disk 50G \
--mount ~/code:/home/ubuntu/code
On GCP, using terraform
See https://github.com/sed-i/tf-gcp/tree/main/charm-dev
terraform apply -var-file="charm-dev.tfvars"
3 Likes
sed-i
(Leon)
2
To view workload UIs deployed in multipass from the host’s browser, you can use any of the following:
SSH port forwarding
$ sudo ssh -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa \
-o "UserKnownHostsFile=/dev/null" \
-o "StrictHostKeyChecking no" \
-L localhost:9090:<PROMETHEUS_UNIT_IP>:9090 \
ubuntu@<MULTIPASS_VM_IP>
Note that if you have ingress in place inside the multipass VM, then you can curl/browse the multipass IP directly, without any port forwarding.
sshuttle
sudo sshuttle -r ubuntu@<MULTIPASS_VM_IP> 0/0 \
--ssh-cmd 'ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking no" -i /var/snap/multipass/common/data/multipassd/ssh-keys/id_rsa'
Add route
sudo ip route add <GRAFANA_K8s_SVC_IP_RANGE> via <MULTIPASS_VM_IP>
h/t @dylanstathis.
vscode port forwarding
h/t @michaeldmitry.
Bridged network
Launch the multipass VM with --network
flag.
h/t @jose
jose
(Jose)
3
Regarding the bridged network you can launch a Multipass VM this way (note the --network enp1s0
)
multipass launch --cloud-init charm-dev-juju-3.4.yaml \
--timeout 1200 \
--name charm-dev-34 \
--memory 8G \
--cpus 4 \
--disk 60G \
--mount /home/jose/trabajos/canonical/repos:/home/ubuntu/repos \
--network enp1s0
Once the machine is working you can check that has an IP provided by the DHCP:
╭─ubuntu@charm-dev-34 ~ [microk8s:cos]
╰─$ ip r | grep default | grep 192
default via 192.168.1.1 dev enp6s0 proto dhcp src 192.168.1.178 metric 200
Now you need to enable metallb
in the VM so Traefik may get an external IP:
sudo microk8s enable metallb 192.168.1.250-192.168.1.255
Note that we are assigning metallb a range between *.250
to *.255
. Make sure that your DHCP
will NOT use those IPs.
Now you can access your charm’s UIs using a LAN IP:
1 Like