How to deploy Charmed OpenSearch¶
This guide shows how to deploy Charmed OpenSearch on LXD, Canonical’s lightweight container hypervisor.
Prerequisites¶
To deploy Charmed OpenSearch on LXD using Juju, you need:
LXD 6.1+
Juju 3.6 (latest LTS)
A Juju controller bootstrapped on LXD and a Juju model for OpenSearch
Hardware that meets the system requirements
For additional guidance, see the Environment setup stage of our tutorial or the documentation for LXD and Juju respectively.
Prepare the environment¶
Configure the environment so that Charmed OpenSearch runs correctly on LXD:
Disable IPv6 on LXD
Configure kernel parameters
On the host
For new containers
Disable IPv6 on LXD¶
Juju does not support IPv6 with LXD. After initializing LXD, disable IPv6 on the default bridge:
lxc network set lxdbr0 ipv6.address none
See The LXD cloud and Juju for more information.
Configure kernel parameters on the host¶
OpenSearch requires specific kernel parameters to be set on the host and propagated to every new LXD container:
vm.swappiness = 0vm.max_map_count = 262144
The net.ipv4.tcp_retries2 parameter is set automatically by the charm and
does not need to be configured manually.
See System requirements for the full list of required kernel parameters and their purpose.
To see the current kernel parameter values before making changes:
sudo sysctl -a | grep -E 'swappiness|max_map_count'
On the host machine, create a sysctl configuration file:
sudo tee /etc/sysctl.d/opensearch.conf <<EOF
vm.swappiness = 0
vm.max_map_count = 262144
EOF
Then, apply the settings:
sudo sysctl -p /etc/sysctl.d/opensearch.conf
Configure kernel parameters for new containers¶
Configure cloud-init so that each new container inherits the required sysctl settings.
Create a cloud-init user-data file:
cat <<EOF > cloudinit-userdata.yaml
cloudinit-userdata: |
postruncmd:
- echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
- echo 'vm.swappiness=0' >> /etc/sysctl.conf
- echo 'fs.file-max=1048576' >> /etc/sysctl.conf
- sysctl -p
EOF
Note
Keep each postruncmd entry as a string. Cloud-init runs string entries through a
shell, so the >> redirection works. Entries written as a YAML list are passed straight to
execve(3) with no shell, so >> would become a literal argument to echo instead of
appending to the file.
To apply this as the default for all new Juju models:
juju model-defaults --file=./cloudinit-userdata.yaml
To apply this as the default for a specific existing model:
juju model-config --file=./cloudinit-userdata.yaml --model <model-name>
Deploy OpenSearch¶
To deploy a single unit of Charmed OpenSearch for testing:
juju deploy opensearch
By default, the charm uses the testing profile, which is optimized for development and testing with lightweight workloads.
To deploy a multi-unit application with the production profile:
juju deploy opensearch -n 3 --config profile=production
See How to optimize cluster performance with profiles for details on the available profiles.
Check the deployment status:
juju status
You should see the opensearch application in a blocked state with the message Missing TLS relation with this cluster.
Charmed OpenSearch requires TLS encryption. To complete the setup, continue with How to manage TLS encryption.