Kubernetes builds the Service in the way of deployment+rbd. the same configuration can succeed in default but fail in non-default?

  docker, question

For example, kubernetes built the Service in the way of deployment+rbd. the same configuration can succeed in default and can access the service, but it fails as long as it is in the non-default namespace? Seek advice from the great god who has encountered similar problems ~ ~

The configuration is as follows (json version):

{
 "kind": "Deployment",
 "spec": {
 "replicas": "1",
 "template": {
 "spec": {
 "volumes": [
 {
 "rbd": {
 "secretRef": {
 "name": "ceph-secret"
 },
 "image": "zhaosiyi.24",
 "fsType": "ext4",
 "readOnly": false,
 "user": "admin",
 "monitors": [
 "xxx.xxx.xxx.6:6789",
 "xxx.xxx.xxx.7:6789",
 "xxx.xxx.xxx.8:6789"
 ],
 "pool": "rrkd.rbd"
 },
 "name": "aa"
 }
 ],
 "imagePullSecrets": [
 {
 "name": "registrykey-m3-1"
 }
 ],
 "containers": [
 {
 "image":  "ccr.ccs.tencentyun.com/rrkd/rrkd-nginx:1.0" ,
 "volumeMounts": [
 {
 "readOnly": false,
 "mountPath": "/mnt",
 "name": "aa"
 }
 ],
 "name": "aa",
 "ports": [
 {
 "protocol": "TCP",
 "containerPort": 80
 }
 ]
 }
 ]
 },
 "metadata": {
 "labels": {
 "name": "aa"
 }
 }
 },
 "selector": {
 "matchLabels": {
 "name": "aa"
 }
 }
 },
 "apiVersion": "extensions/v1beta1",
 "metadata": {
 "labels": {
 "name": "aa"
 },
 "name": "aa"
 }
 }
 {
 "kind": "Service",
 "spec": {
 "type": "NodePort",
 "ports": [
 {
 "targetPort": 80,
 "protocol": "TCP",
 "port": 80
 }
 ],
 "selector": {
 "name": "aa"
 }
 },
 "apiVersion": "v1",
 "metadata": {
 "labels": {
 "name": "aa"
 },
 "name": "aa"
 }
 }

The strangest thing is that the detailed information of describe pod shows success without any error message, but get pod actually failed, as shown in the following figure:
图片描述
图片描述

The problem has been solved. Non-default is unsuccessful because the newly created namespace does not have a Secret, thus authentication fails when pulling image, so the Secret for pulling image needs to be created manually. If it is rbd or pvc mode, you also need to manually create a Secret for mounting storage.

https://kubernetes.io/docs/co …