How to Install Guacamole on Kubernetes

Flow
2 min readApr 18, 2023

Lets make this quick and simple.

Copy and paste these commands in the terminal.

mkdir -p /kubernetes_config/gucamole/
kubectl delete namespace guacamole
kubectl delete -f /kubernetes_config/gucamole/gucamole-config.yaml
rm -rf /kubernetes_config/gucamole/gucamole-config.yaml
nano /kubernetes_config/gucamole/gucamole-config.yaml

[COPY AND PASTE THE YAML FILE BELOW]

kubectl apply -f /kubernetes_config/gucamole/gucamole-config.yaml

Here is the yaml file.

apiVersion: v1
kind: Namespace
metadata:
name: guacamole
---
apiVersion: v1
kind: Service
metadata:
name: guacd
namespace: guacamole
spec:
selector:
app: guacd
ports:
- protocol: TCP
port: 4822
targetPort: 4822
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: guacamole
spec:
selector:
app: postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
name: guacamole
namespace: guacamole
spec:
selector:
app: guacamole
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: LoadBalancer

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: guacd
namespace: guacamole
spec:
replicas: 1
selector:
matchLabels:
app: guacd
template:
metadata:
labels:
app: guacd
spec:
containers:
- name: guacd
image: linuxserver/guacd:latest
volumeMounts:
- name: drive
mountPath: /drive
- name: record
mountPath: /record
volumes:
- name: drive
hostPath:
path: /guacamole/drive
- name: record
hostPath:
path: /guacamole/record
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: guacamole
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:13.4
env:
- name: PGDATA
value: /var/lib/postgresql/data/guacamole
- name: POSTGRES_DB
value: guacamole_db
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PASSWORD
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_USER
volumeMounts:
- name: init
mountPath: /docker-entrypoint-initdb.d
- name: data
mountPath: /var/lib/postgresql/data
volumes:
- name: init
hostPath:
path: /guacamole/init
- name: data
hostPath:
path: /guacamole/data
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: guacamole
namespace: guacamole
spec:
replicas: 1
selector:
matchLabels:
app: guacamole
template:
metadata:
labels:
app: guacamole
spec:
containers:
- name: guacamole
image: jwetzell/guacamole:arm64
env:
- name: EXTENSIONS
value: auth-totp
- name: GUACD_HOSTNAME
value: guacd
- name: POSTGRES_DATABASE
value: guacamole_db
- name: POSTGRES_HOSTNAME
value: postgres
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PASSWORD
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_USER
- name: POSTGRESQL_AUTO_CREATE_ACCOUNTS
value: "true"
volumeMounts:
- name: drive
mountPath: /drive
volumes:
- name: drive
hostPath:
path: /guacamole/drive
---
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
namespace: guacamole
type: Opaque
data:
POSTGRES_USER: Z3VhY2Ftb2xl
POSTGRES_PASSWORD: Z3VhY2Ftb2xl

Done. This does all the necessary deployments to make everything work out of the box. Note: This has 2FA enabled in the yaml file with Google Authenticator.

Troubleshooting:

If you get “exec” error, then your machine architecture is not ARM. So you will just need to change the images. So just search for any line that says “image” in that yaml file and change it to the correct image for your architecture.

--

--