这是我给管理员的 yaml:
kind: Service
metadata:
name: adminer-1598029219
labels:
app.kubernetes.io/name: adminer
helm.sh/chart: adminer-0.1.5
app.kubernetes.io/instance: adminer-1598029219
app.kubernetes.io/managed-by: Helm
spec:
type: NodePort
ports:
- port: 8000
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: adminer
app.kubernetes.io/instance: adminer-1598029219
---
# Source: adminer/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: adminer-1598029219
labels:
app.kubernetes.io/name: adminer
helm.sh/chart: adminer-0.1.5
app.kubernetes.io/instance: adminer-1598029219
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: adminer
app.kubernetes.io/instance: adminer-1598029219
template:
metadata:
labels:
app.kubernetes.io/name: adminer
app.kubernetes.io/instance: adminer-1598029219
spec:
containers:
- name: adminer
image: "dockette/adminer:full"
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
env:
- name: ADMINER_PLUGINS
value:
- name: ADMINER_DESIGN
value: pepa-linha
- name: ADMINER_DEFAULT_SERVER
value:
resources:
{}
livenessProbe:
null
readinessProbe:
null
这是我为 mongoDB 准备的 yaml
kind: Service
metadata:
name: mongo
labels:
name: mongo
app: mongo
spec:
ports:
- port: 27017
targetPort: 27017
name: web
clusterIP: None
selector:
role: mongo
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: mongo # has to match .spec.template.metadata.labels
serviceName: "mongo"
replicas: 3
template:
metadata:
labels:
app: mongo
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongo
image: mongo
command:
- mongod
- "--replSet"
- rs0
- "--smallfiles"
- "--noprealloc"
ports:
- containerPort: 27017
name: web
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-persistent-storage
annotations:
volume.beta.kubernetes.io/storage-class: "fast"
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
所以我的问题是我无法登录 mongod,因为我是从管理员那里得到的: 管理员不支持在没有密码的情况下访问数据库。有什么简单的解决方案可以让我登录到我的 mongod 吗?PS我运行kubernetes