Upon deploying a fresh StarRocks cluster, the root
user’s password remains unset, potentially posing a security risk.
This guide delineates the process to establish a root password when a new installation.
Note that this only works for helm install, can’t use it in helm upgrade
In this guide, we will use starrocks/kube-starrocks
chart to deploy both StarRocks operator and cluster.
The values.yaml file contains the default configurations for the StarRocks Operator and the StarRocks cluster.
helm show values starrocks/kube-starrocks > values.yaml
The following is a snippet of the values.yaml file:
starrocks:
# This configuration is used to modify the root password during initial deployment.
# After deployment is completed, it won't take effect to modify the password here and to do a `helm upgrade`.
# It also supports providing secret name that contains password, using the password in the secret instead of the plaintext in the values.yaml.
# When both password and passwordSecret are set, only passwordSecret takes effect.
initPassword:
enabled: false
password: ""
# The secret name that contains password, the key of the secret is "password", and you should create it first.
passwordSecret: ""
Configure a YAML File for Custom Settings (for instance, my-values.yaml
). There are two ways to
initialize the root password. You can choose one of them.
We use mysql_password
serves as a placeholder for the root user’s password. You can substitute this
with any preferred password.
To initialize the root password, embed the following snippet:
starrocks:
initPassword:
enabled: true
password: "mysql_password"
You can also use a secret to set the root password. The secret must be created before deploying the helm chart.
Note the key of the secret must be
password
.
kubectl create secret generic starrocks-root-password --from-literal=password=mysql_password
To initialize the root password, embed the following snippet:
starrocks:
initPassword:
enabled: true
passwordSecret: starrocks-root-password
Execute Deployment with Custom Specifications. Run the subsequent command to deploy the StarRocks Operator and the StarRocks cluster.
helm install -f my-values.yaml starrocks starrocks/kube-starrocks
# in one terminal
kubectl port-forward service/kube-starrocks-fe-service 9030:9030
# in another terminal
mysql -h 127.0.0.1 -P 9030 -u root -p mysql_password