我使用的是社区版Aeropike docker图像。我们的k8s集群不允许以root身份运行容器。因此,我开始遵循这个文档,以非root身份运行。
但是当运行图像时,我得到的错误
link eth0 state up
link eth0 state up in 0
Dec 02 2021 10:15:12 GMT: CRITICAL (config): (cfg.c:2168) line 6 :: user not found: 8888
Dec 02 2021 10:15:12 GMT: WARNING (as): (signal.c:166) SIGINT received, shutting down Aerospike Community Edition build 5.6.0.7 os debian10
Dec 02 2021 10:15:12 GMT: WARNING (as): (signal.c:169) startup was not complete, exiting immediately
我在我的Aeropike conf 中有以下配置
service {
user 8888
group 8888
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
pidfile /var/run/aerospike/asd.pid
# service-threads 6 # cpu x 5 in 4.7
# transaction-queues 6 # obsolete in 4.7
# transaction-threads-per-queue 4 # obsolete in 4.7
proto-fd-max 15000
}
下面是我的k8s配置
apiVersion: apps/v1
kind: Deployment
metadata:
name: aerospike
labels:
app: aerospike
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0%
maxUnavailable: 100%
selector:
matchLabels:
app: aerospike
template:
metadata:
labels:
app: aerospike
spec:
terminationGracePeriodSeconds: 30
volumes:
- name: config-volume
configMap:
name: aerospikeconfig
containers:
- name: aerospike-container
image: aerospikeimage
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /etc/aerospike/
name: config-volume
env:
- name: NAMESPACE
value: "bar"
securityContext:
runAsUser: 8888
runAsGroup: 8888
runAsNonRoot: true
resources:
requests:
memory: 1Gi
cpu: 1
limits:
memory: 1Gi
cpu: 1
我认为这与Kubernetes无关,只是Aeropike您正在使用uid/gid
user 8888
group 8888
你能试着使用用户名/组名吗
service {
user aerospike
group aerospike
paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
pidfile /var/run/aerospike/asd.pid
# service-threads 6 # cpu x 5 in 4.7
# transaction-queues 6 # obsolete in 4.7
# transaction-threads-per-queue 4 # obsolete in 4.7
proto-fd-max 15000
}