51 lines
2.1 KiB
Plaintext
51 lines
2.1 KiB
Plaintext
CockroachDB can be accessed via port {{ .Values.service.ports.grpc.external.port }} at the
|
|
following DNS name from within your cluster:
|
|
|
|
{{ template "cockroachdb.fullname" . }}-public.{{ .Release.Namespace }}.svc.cluster.local
|
|
|
|
Because CockroachDB supports the PostgreSQL wire protocol, you can connect to
|
|
the cluster using any available PostgreSQL client.
|
|
|
|
{{- if not .Values.tls.enabled }}
|
|
|
|
For example, you can open up a SQL shell to the cluster by running:
|
|
|
|
kubectl run -it --rm cockroach-client \
|
|
--image=cockroachdb/cockroach \
|
|
--restart=Never \
|
|
{{- if .Values.networkPolicy.enabled }}
|
|
--labels="{{ template "cockroachdb.fullname" . }}-client=true" \
|
|
{{- end }}
|
|
--command -- \
|
|
./cockroach sql --insecure --host={{ template "cockroachdb.fullname" . }}-public.{{ .Release.Namespace }}
|
|
|
|
From there, you can interact with the SQL shell as you would any other SQL
|
|
shell, confident that any data you write will be safe and available even if
|
|
parts of your cluster fail.
|
|
{{- else }}
|
|
|
|
Note that because the cluster is running in secure mode, any client application
|
|
that you attempt to connect will either need to have a valid client certificate
|
|
or a valid username and password.
|
|
{{- end }}
|
|
|
|
{{- if and (.Values.networkPolicy.enabled) (not (empty .Values.networkPolicy.ingress.grpc)) }}
|
|
|
|
Note: Since NetworkPolicy is enabled, the only Pods allowed to connect to this
|
|
CockroachDB cluster are:
|
|
|
|
1. Having the label: "{{ template "cockroachdb.fullname" . }}-client=true"
|
|
|
|
2. Matching the following rules: {{- toYaml .Values.networkPolicy.ingress.grpc | nindent 0 }}
|
|
{{- end }}
|
|
|
|
Finally, to open up the CockroachDB admin UI, you can port-forward from your
|
|
local machine into one of the instances in the cluster:
|
|
|
|
kubectl port-forward {{ template "cockroachdb.fullname" . }}-0 {{ index .Values.conf `http-port` | int64 }}
|
|
|
|
Then you can access the admin UI at http{{ if .Values.tls.enabled }}s{{ end }}://localhost:{{ index .Values.conf `http-port` | int64 }}/ in your web browser.
|
|
|
|
For more information on using CockroachDB, please see the project's docs at:
|
|
https://www.cockroachlabs.com/docs/
|