Kubernetes在部署+ rbd模式下创建服务,同样配置为在默认命名空间中成功,在非默认命名空间下失败?

时间:2017-09-12 06:45:45

标签: docker kubernetes containers kubectl

Kubernetes在部署+ rbd模式下创建服务,同样配置为在默认命名空间中成功,在非默认命名空间下失败?

配置(json):



{    
    "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"
    }
}




最奇怪的是描述广告的详细信息显示成功,没有任何错误信息,但获取广告实际上并不成功,如下所示:
enter image description here

enter image description here

2 个答案:

答案 0 :(得分:0)

问题已经解决了。命名空间的非默认值不成功,因为新命名空间没有Secret,因此在pull image处验证失败。需要手动为拉图像创建秘密。如果是RBD或PVC模式,您还需要手动创建用于安装存储的密钥。

答案 1 :(得分:0)

您能否详细了解pod的描述? 我认为它会显示失败的日志 它总是你没有秘密或秘密不好, 并且ceph可能也是错误的