-
Notifications
You must be signed in to change notification settings - Fork 0
Kubernetes example
strowk edited this page Nov 2, 2023
·
5 revisions
Imagine you have a Postgres database deployed to Kubernetes or being accessible from Kubernetes.
Something like this for demonstration:
cat << EOF | kubectl create -f -
---
apiVersion: v1
kind: Pod
metadata:
labels:
run: postgres
name: postgres
spec:
containers:
- image: postgres
name: postgres
env:
- name: POSTGRES_PASSWORD
value: secretpwd
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
labels:
run: postgres
name: postgres
spec:
ports:
- port: 5432
protocol: TCP
targetPort: 5432
selector:
run: postgres
EOF
Then following is an example how you can rollout pod with tisq installed and configured with corresponding server entry and custom keybindings:
cat << EOF | kubectl create -f -
apiVersion: v1
kind: Pod
metadata:
labels:
run: tisq
name: tisq
spec:
volumes:
- name: tisq-configs
emptyDir: {}
initContainers:
- image: ghcr.io/strowk/tisq:main-alpine
imagePullPolicy: Always
name: tisq-init
command: [ "tisq", "server", "add", "my-server", "postgres://postgres:secretpwd@postgres:5432/test" ]
volumeMounts:
- name: tisq-configs
mountPath: /root/.tisq
- image: ghcr.io/strowk/tisq:main-alpine
name: tisq-init-keybindings
command:
- sh
- -c
- |
cat << EOF > /root/.tisq/config.toml
[keybindings.editor]
# Kubectl exec sends Ctrl+/ as Ctrl+7
EditorToggleComment = [
{ modifiers = "Ctrl", key = { type = "Char", args = "7" } },
]
EOF
volumeMounts:
- name: tisq-configs
mountPath: /root/.tisq
containers:
- image: ghcr.io/strowk/tisq:main-alpine
name: waiter
command: [ "tail", "-f", "/dev/null" ]
volumeMounts:
- name: tisq-configs
mountPath: /root/.tisq
EOF
Once this pod started, you can connect to it at any time like this:
kubectl exec -ti tisq -- tisq