Skip to content

Instantly share code, notes, and snippets.

@aslafy-z
Created October 11, 2024 21:59
Show Gist options
  • Select an option

  • Save aslafy-z/05a35a28ac85955c2b7d4cca1bbf24df to your computer and use it in GitHub Desktop.

Select an option

Save aslafy-z/05a35a28ac85955c2b7d4cca1bbf24df to your computer and use it in GitHub Desktop.
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: steampipe-sa
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: steampipe-role
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: steampipe-role-binding
subjects:
- kind: ServiceAccount
name: steampipe-sa
namespace: default
roleRef:
kind: ClusterRole
name: steampipe-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ConfigMap
metadata:
name: steampipe-config
namespace: default
data:
config.spc: |
connection "kubernetes" {
plugin = "kubernetes"
# use in-cluster config
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: steampipe
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: steampipe
template:
metadata:
labels:
app: steampipe
spec:
serviceAccountName: steampipe-sa
initContainers:
- name: install-plugins
image: turbot/steampipe:latest
command: ["/bin/sh", "-c"]
args:
- |
steampipe plugin install kubernetes && \
steampipe plugin list
volumeMounts:
- name: plugins
mountPath: /home/steampipe/.steampipe/plugins
containers:
- name: steampipe
image: turbot/steampipe:latest
args:
- service
- start
- --foreground
- --database-listen=network
- --database-port=9193
- --database-password=steampipe
ports:
- name: database
containerPort: 9193
volumeMounts:
- name: config
mountPath: /home/steampipe/.steampipe/config/config.spc
subPath: config.spc
readOnly: true
- name: plugins
mountPath: /home/steampipe/.steampipe/plugins
volumes:
- name: config
configMap:
name: steampipe-config
- name: plugins
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: steampipe
namespace: default
spec:
selector:
app: steampipe
ports:
- port: 9193
targetPort: database
name: database
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: datasource-steampipe-kubernetes
namespace: default
labels:
grafana_datasource: "1"
data:
datasource.yaml: |
apiVersion: 1
datasources:
- name: steampipe-kubernetes
type: postgres
url: steampipe:9193
user: steampipe
secureJsonData:
password: steampipe
jsonData:
database: steampipe
sslmode: disable
maxOpenConns: 100
maxIdleConns: 100
maxIdleConnsAuto: true
connMaxLifetime: 14400
postgresVersion: 1400
timescaledb: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment