Closed alexandre-touret closed 22 hours ago
I suspect this issue could be cause by a custom security context of your Kubernetes cluster. Other users with a similar issue fixed it the field spec.deploymentPlan.podSecurityContext.fsGroup
to 0
, for further details see https://github.com/artemiscloud/activemq-artemis-operator/issues/187#issuecomment-2045575143
Could you dump and share your ActiveMQArtemis CR before trying to set the field spec.deploymentPlan.podSecurityContext.fsGroup
to 0
?
kubectl get ActiveMQArtemis <NAME> -o yaml
Thanks for your response. Here the output of the command you asked me
kubectl get ActiveMQArtemis artemis-broker -o yaml
apiVersion: broker.amq.io/v1beta1
kind: ActiveMQArtemis
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"broker.amq.io/v1beta1","kind":"ActiveMQArtemis","metadata":{"annotations":{},"name":"artemis-broker","namespace":"activemq-artemis-operator"},"spec":{"deploymentPlan":{"enableMetricsPlugin":true,"messageMigration":true,"persistenceEnabled":true,"size":2}}}
creationTimestamp: "2024-11-22T14:55:27Z"
generation: 1
name: artemis-broker
namespace: activemq-artemis-operator
resourceVersion: "48789251"
uid: 5bce607f-6d1b-498c-b388-8f7768ba0eca
spec:
deploymentPlan:
enableMetricsPlugin: true
messageMigration: true
persistenceEnabled: true
size: 2
status:
conditions:
- lastTransitionTime: "2024-11-22T14:55:27Z"
message: ""
observedGeneration: 1
reason: ValidationSucceded
status: "True"
type: Valid
- lastTransitionTime: "2024-11-22T14:55:27Z"
message: no available brokers from deployed condition
reason: UnableToRetrieveStatus
status: Unknown
type: BrokerPropertiesApplied
- lastTransitionTime: "2024-11-22T14:55:27Z"
message: '0/2 pods ready {artemis-broker-ss-0: Pending [{PodReadyToStartContainers=False}{Initialized=False
ContainersNotInitialized containers with incomplete status: [artemis-broker-container-init]}{Ready=False
ContainersNotReady containers with unready status: [artemis-broker-container]}{ContainersReady=False
ContainersNotReady containers with unready status: [artemis-broker-container]}{PodScheduled=True}]}'
reason: PodsNotReady
status: "False"
type: Deployed
- lastTransitionTime: "2024-11-22T14:55:27Z"
message: Some conditions are not met
reason: WaitingForAllConditions
status: "False"
type: Ready
deploymentPlanSize: 2
podStatus:
starting:
- artemis-broker-ss-0
scaleLabelSelector: ActiveMQArtemis=artemis-broker,application=artemis-broker-app
upgrade:
majorUpdates: true
minorUpdates: true
patchUpdates: true
securityUpdates: true
version:
brokerVersion: 2.38.0
image: quay.io/artemiscloud/activemq-artemis-broker-kubernetes@sha256:1c2d9fcc1d9462a81dce163e74629d294728d4180262c83ccfa908868ff28d26
initImage: quay.io/artemiscloud/activemq-artemis-broker-init@sha256:55b614c1f3ff359ae1f98d0de831d649f7f1a3fa0bdb6979aa81dd8fd6156f45
@alexandre-touret thanks for sharing your AcriveMQArtemis CR. Could you also share the dump of your broker pod before setting the field spec.deploymentPlan.podSecurityContext.fsGroup
to 0
?
kubectl get pod artemis-broker-ss-0 -o yaml
Hi You can find below the output of the command.
BTW I applied the configuration you mentioned
spec.deploymentPlan.podSecurityContext.fsGroup
to 0
. It works
kubectl get pod artemis-broker-cluster-ss-0 -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2024-11-22T15:33:08Z"
generateName: artemis-broker-cluster-ss-
labels:
ActiveMQArtemis: artemis-broker-cluster
application: artemis-broker-cluster-app
apps.kubernetes.io/pod-index: "0"
controller-revision-hash: artemis-broker-cluster-ss-7cb6d84fb6
statefulset.kubernetes.io/pod-name: artemis-broker-cluster-ss-0
name: artemis-broker-cluster-ss-0
namespace: activemq-artemis-operator
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: StatefulSet
name: artemis-broker-cluster-ss
uid: 0e9d9cb0-e8ae-4433-b4fe-e1ecaac7b1c5
resourceVersion: "48819710"
uid: 89529094-5873-4559-9e33-93c9f29da5fc
spec:
affinity: {}
automountServiceAccountToken: true
containers:
- command:
- /bin/bash
- -c
- export STATEFUL_SET_ORDINAL=${HOSTNAME##*-}; export JDK_JAVA_OPTIONS=${JDK_JAVA_OPTIONS//\$\{STATEFUL_SET_ORDINAL\}/${HOSTNAME##*-}};
export FQ_HOST_NAME=$(hostname -f); export JAVA_ARGS_APPEND=$( echo ${JAVA_ARGS_APPEND}
| sed "s/FQ_HOST_NAME/${FQ_HOST_NAME}/"); exec /opt/amq/bin/launch.sh
- start
env:
- name: AMQ_ROLE
value: admin
- name: AMQ_NAME
value: amq-broker
- name: AMQ_TRANSPORTS
- name: AMQ_QUEUES
- name: AMQ_ADDRESSES
- name: AMQ_GLOBAL_MAX_SIZE
value: 100 mb
- name: AMQ_REQUIRE_LOGIN
value: "false"
- name: AMQ_EXTRA_ARGS
value: --no-autotune
- name: AMQ_ANYCAST_PREFIX
- name: AMQ_MULTICAST_PREFIX
- name: POD_NAMESPACE
- name: AMQ_JOURNAL_TYPE
value: nio
- name: TRIGGERED_ROLL_COUNT
value: 79304a5e
- name: PING_SVC_NAME
value: artemis-broker-cluster-ping-svc
- name: OPENSHIFT_DNS_PING_SERVICE_PORT
value: "7800"
- name: AMQ_DATA_DIR
value: /opt/artemis-broker-cluster/data
- name: AMQ_DATA_DIR_LOGGING
value: "true"
- name: AMQ_CLUSTERED
value: "true"
- name: AMQ_ENABLE_JOLOKIA_AGENT
value: "false"
- name: AMQ_ENABLE_MANAGEMENT_RBAC
value: "false"
- name: AMQ_ENABLE_METRICS_PLUGIN
value: "true"
- name: CONFIG_BROKER
value: "false"
- name: CONFIG_INSTANCE_DIR
value: /amq/init/config
- name: JDK_JAVA_OPTIONS
value: -Dbroker.properties=/amq/extra/secrets/artemis-broker-cluster-props/broker.properties
- name: AMQ_CLUSTER_PASSWORD
valueFrom:
secretKeyRef:
key: AMQ_CLUSTER_PASSWORD
name: artemis-broker-cluster-credentials-secret
- name: AMQ_CLUSTER_USER
valueFrom:
secretKeyRef:
key: AMQ_CLUSTER_USER
name: artemis-broker-cluster-credentials-secret
- name: AMQ_PASSWORD
valueFrom:
secretKeyRef:
key: AMQ_PASSWORD
name: artemis-broker-cluster-credentials-secret
- name: AMQ_USER
valueFrom:
secretKeyRef:
key: AMQ_USER
name: artemis-broker-cluster-credentials-secret
- name: AMQ_ACCEPTORS
valueFrom:
secretKeyRef:
key: AMQ_ACCEPTORS
name: artemis-broker-cluster-netty-secret
- name: AMQ_CONNECTORS
valueFrom:
secretKeyRef:
key: AMQ_CONNECTORS
name: artemis-broker-cluster-netty-secret
image: quay.io/artemiscloud/activemq-artemis-broker-kubernetes@sha256:1c2d9fcc1d9462a81dce163e74629d294728d4180262c83ccfa908868ff28d26
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 8161
timeoutSeconds: 5
name: artemis-broker-cluster-container
ports:
- containerPort: 8161
name: wconsj
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- /opt/amq/bin/readinessProbe.sh 1
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /opt/artemis-broker-cluster/data
name: artemis-broker-cluster
- mountPath: /amq/extra/secrets/artemis-broker-cluster-props
name: secret-artemis-broker-cluster-props
readOnly: true
- mountPath: /amq/init/config
name: amq-cfg-dir
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-x5qxj
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
hostname: artemis-broker-cluster-ss-0
initContainers:
- args:
- -c
- /opt/amq/bin/launch.sh && /opt/amq-broker/script/default.sh
command:
- /bin/bash
env:
- name: AMQ_ROLE
value: admin
- name: AMQ_NAME
value: amq-broker
- name: AMQ_TRANSPORTS
- name: AMQ_QUEUES
- name: AMQ_ADDRESSES
- name: AMQ_GLOBAL_MAX_SIZE
value: 100 mb
- name: AMQ_REQUIRE_LOGIN
value: "false"
- name: AMQ_EXTRA_ARGS
value: --no-autotune
- name: AMQ_ANYCAST_PREFIX
- name: AMQ_MULTICAST_PREFIX
- name: POD_NAMESPACE
- name: AMQ_JOURNAL_TYPE
value: nio
- name: TRIGGERED_ROLL_COUNT
value: "0"
- name: PING_SVC_NAME
value: artemis-broker-cluster-ping-svc
- name: OPENSHIFT_DNS_PING_SERVICE_PORT
value: "7800"
- name: AMQ_DATA_DIR
value: /opt/artemis-broker-cluster/data
- name: AMQ_DATA_DIR_LOGGING
value: "true"
- name: AMQ_CLUSTERED
value: "true"
- name: AMQ_ENABLE_JOLOKIA_AGENT
value: "false"
- name: AMQ_ENABLE_MANAGEMENT_RBAC
value: "false"
- name: AMQ_ENABLE_METRICS_PLUGIN
value: "true"
- name: RUN_BROKER
value: "false"
- name: CONFIG_INSTANCE_DIR
value: /amq/init/config
- name: AMQ_CLUSTER_PASSWORD
valueFrom:
secretKeyRef:
key: AMQ_CLUSTER_PASSWORD
name: artemis-broker-cluster-credentials-secret
- name: AMQ_CLUSTER_USER
valueFrom:
secretKeyRef:
key: AMQ_CLUSTER_USER
name: artemis-broker-cluster-credentials-secret
- name: AMQ_PASSWORD
valueFrom:
secretKeyRef:
key: AMQ_PASSWORD
name: artemis-broker-cluster-credentials-secret
- name: AMQ_USER
valueFrom:
secretKeyRef:
key: AMQ_USER
name: artemis-broker-cluster-credentials-secret
- name: AMQ_ACCEPTORS
valueFrom:
secretKeyRef:
key: AMQ_ACCEPTORS
name: artemis-broker-cluster-netty-secret
- name: AMQ_CONNECTORS
valueFrom:
secretKeyRef:
key: AMQ_CONNECTORS
name: artemis-broker-cluster-netty-secret
image: quay.io/artemiscloud/activemq-artemis-broker-init@sha256:55b614c1f3ff359ae1f98d0de831d649f7f1a3fa0bdb6979aa81dd8fd6156f45
imagePullPolicy: IfNotPresent
name: artemis-broker-cluster-container-init
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /amq/init/config
name: amq-cfg-dir
- mountPath: /init_cfg_root
name: tool-dir
- mountPath: /amq/extra/secrets/artemis-broker-cluster-props
name: secret-artemis-broker-cluster-props
readOnly: true
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: kube-api-access-x5qxj
readOnly: true
nodeName: gke-gke-cluster-dev-node-pool20241010-2b30ce33-ia5o
preemptionPolicy: PreemptLowerPriority
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
serviceAccount: default
serviceAccountName: default
subdomain: artemis-broker-cluster-hdls-svc
terminationGracePeriodSeconds: 60
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
- name: artemis-broker-cluster
persistentVolumeClaim:
claimName: artemis-broker-cluster-artemis-broker-cluster-ss-0
- name: secret-artemis-broker-cluster-props
secret:
defaultMode: 420
secretName: artemis-broker-cluster-props
- emptyDir: {}
name: amq-cfg-dir
- emptyDir: {}
name: tool-dir
- name: kube-api-access-x5qxj
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 3607
path: token
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- downwardAPI:
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2024-11-22T15:33:14Z"
status: "True"
type: PodReadyToStartContainers
- lastProbeTime: null
lastTransitionTime: "2024-11-22T15:33:17Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2024-11-22T15:33:33Z"
status: "True"
type: Ready
- lastProbeTime: null
lastTransitionTime: "2024-11-22T15:33:33Z"
status: "True"
type: ContainersReady
- lastProbeTime: null
lastTransitionTime: "2024-11-22T15:33:08Z"
status: "True"
type: PodScheduled
containerStatuses:
- containerID: containerd://2cbbffcacbceee4a46dabc5c1dd1414d2c8082f3f1172b0c1a896698289eff56
image: sha256:51e758677edd5f762ca85830d486afbc725bde0bed9b25b5a13269aca8dd72ab
imageID: quay.io/artemiscloud/activemq-artemis-broker-kubernetes@sha256:1c2d9fcc1d9462a81dce163e74629d294728d4180262c83ccfa908868ff28d26
lastState: {}
name: artemis-broker-cluster-container
ready: true
restartCount: 0
started: true
state:
running:
startedAt: "2024-11-22T15:33:17Z"
hostIP: 10.123.150.148
hostIPs:
- ip: 10.123.150.148
initContainerStatuses:
- containerID: containerd://c9723b4c8edaf7478dfbbaaf2684eafd013e9330233942aa5259e1a622054c32
image: sha256:f10f348f0100cd4ad9d8e551e79cf9b35e1ae1b0fb02df33ad2cd7c4072a04c9
imageID: quay.io/artemiscloud/activemq-artemis-broker-init@sha256:55b614c1f3ff359ae1f98d0de831d649f7f1a3fa0bdb6979aa81dd8fd6156f45
lastState: {}
name: artemis-broker-cluster-container-init
ready: true
restartCount: 0
started: false
state:
terminated:
containerID: containerd://c9723b4c8edaf7478dfbbaaf2684eafd013e9330233942aa5259e1a622054c32
exitCode: 0
finishedAt: "2024-11-22T15:33:17Z"
reason: Completed
startedAt: "2024-11-22T15:33:14Z"
phase: Running
podIP: 100.83.131.33
podIPs:
- ip: 100.83.131.33
qosClass: BestEffort
startTime: "2024-11-22T15:33:08Z"
I'm glad that setting spec.deploymentPlan.podSecurityContext.fsGroup
to 0
worked. Thanks for sharing your dumps. For some reason the persistent volumes created by your Kubernetes cluster allow write access only to the user of the group 0 but I don't see any custom security context settings in your dumps.
I don't remember if I captured the configuration before applying the configuration (i.e., fsGroup) or after. Anyway, it could be nice to add this tip to your documentation.
@alexandre-touret your proposal to add this tip to your documentation makes sense to me but I need to understand what is causing this issue in some Kubernetes clusters and what are the alternatives.
IMO we can close this issue Perhaps, I will submit another one for improving the documentation ;)
Describe the bug I can't start create a broker enabling the persistence.
I always have the following error message during the startup of the pod:
Here is my stack:
Below, the steps I applied:
You can get below the events:
And the description of the StateFulSet
And the description of the PVC
How can I fix this issue please ?