Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set k3s to use mysql as datastore, not etcd #66

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions deploy/balena-k3s/server/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ set -eu
# https://docs.k3s.io/datastore/ha-embedded
# https://github.com/balena-io-experimental/balena-k3s/blob/main/server/server.sh

if [ -n "${K3S_URL:-}" ]; then
# shellcheck disable=SC2086
exec /bin/k3s server --server "${K3S_URL}" ${EXTRA_K3S_SERVER_ARGS:-}
else
# shellcheck disable=SC2086
exec /bin/k3s server --cluster-init ${EXTRA_K3S_SERVER_ARGS:-}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --cluster-init flag is what tells k3s to use etcd. This server.sh script I coopted from the balena-k3s repo is meant to allow users to setup multi-node clusters, but we dont care about doing that here.

fi

# NOTE: this script is only intended to support a single-node "cluster". Multi-node
# clusters require using ectd as a datastore, instead of the default mysql. Etcd
tyler-romero marked this conversation as resolved.
Show resolved Hide resolved
# doesnt work well when the underlying storage is an sd card, like on raspberry pi.
# If we ever do want multi-node we'd have to pass `--server` or `--cluster-init` args to k3s
exec /bin/k3s server ${EXTRA_K3S_SERVER_ARGS:-}
2 changes: 1 addition & 1 deletion deploy/bin/cluster_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if [[ -n "${EDGE_CONFIG}" ]]; then
echo "Creating config from EDGE_CONFIG env var"
$K create configmap edge-config --from-literal="edge-config.yaml=${EDGE_CONFIG}"
else
echo "Creating config from configs/edeg-config.yaml"
echo "Creating config from configs/edge-config.yaml"
$K create configmap edge-config --from-file=configs/edge-config.yaml
fi

Expand Down
Loading