gpt4 book ai didi

docker - K8s SQL2019 HA 容器 - 伙计,我的 Pod 在哪里?

转载 作者:行者123 更新时间:2023-12-02 11:38:35 28 4
gpt4 key购买 nike

K8s 新手。到目前为止,我有以下内容:

  • docker-ce-19.03.8
  • docker-ce-cli-19.03.8
  • containerd.io-1.2.13
  • kubelet-1.18.5
  • kubeadm-1.18.5
  • kubectl-1.18.5
  • etcd-3.4.10
  • 使用法兰绒做 Pod Overlay Net
  • 执行所有主机级工作(SELinux 许可、交换等)
  • 本地 Vsphere 环境中的所有 Centos7 (6.7U3)

  • 我已经构建了我所有的配置,目前有:
  • 具有点对点和客户端-服务器加密传输的 3 节点外部/独立 etcd 集群
  • 一个 3 节点控制平面集群——kubeadm init 使用 x509s 引导,目标是 3 个 etcd(因此堆叠的 etcd 永远不会发生)
  • HAProxy 和 Keepalived 安装在两个 etcd 集群成员上,对控制平面 (TCP6443) 上的 API 服务器端点的负载平衡访问
  • 6 个工作节点
  • 使用树内 Vmware 云提供商配置的存储(我知道它已被弃用)--是的,这是我的默认 SC

  • 状态检查:
  • kubectl 集群信息报告:

  • [me@km-01 pods]$ kubectl cluster-info
    Kubernetes master is running at https://k8snlb:6443
    KubeDNS is running at https://k8snlb:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

    kubectl 获取所有 --all-namespaces 报告:
    [me@km-01 pods]$ kubectl get all --all-namespaces -owide
    NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
    ag1 pod/mssql-operator-68bcc684c4-rbzvn 1/1 Running 0 86m 10.10.4.133 kw-02.bogus.local <none> <none>
    kube-system pod/coredns-66bff467f8-k6m94 1/1 Running 4 20h 10.10.0.11 km-01.bogus.local <none> <none>
    kube-system pod/coredns-66bff467f8-v848r 1/1 Running 4 20h 10.10.0.10 km-01.bogus.local <none> <none>
    kube-system pod/kube-apiserver-km-01.bogus.local 1/1 Running 8 10h x.x.x..25 km-01.bogus.local <none> <none>
    kube-system pod/kube-controller-manager-km-01.bogus.local 1/1 Running 2 10h x.x.x..25 km-01.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-7l76c 1/1 Running 0 10h x.x.x..30 kw-01.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-8kft7 1/1 Running 0 10h x.x.x..33 kw-04.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-r5kqv 1/1 Running 0 10h x.x.x..34 kw-05.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-t6xcd 1/1 Running 0 10h x.x.x..35 kw-06.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-vhnx8 1/1 Running 0 10h x.x.x..32 kw-03.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-xdk2n 1/1 Running 0 10h x.x.x..31 kw-02.bogus.local <none> <none>
    kube-system pod/kube-flannel-ds-amd64-z4kfk 1/1 Running 4 20h x.x.x..25 km-01.bogus.local <none> <none>
    kube-system pod/kube-proxy-49hsl 1/1 Running 0 10h x.x.x..35 kw-06.bogus.local <none> <none>
    kube-system pod/kube-proxy-62klh 1/1 Running 0 10h x.x.x..34 kw-05.bogus.local <none> <none>
    kube-system pod/kube-proxy-64d5t 1/1 Running 0 10h x.x.x..30 kw-01.bogus.local <none> <none>
    kube-system pod/kube-proxy-6ch42 1/1 Running 4 20h x.x.x..25 km-01.bogus.local <none> <none>
    kube-system pod/kube-proxy-9css4 1/1 Running 0 10h x.x.x..32 kw-03.bogus.local <none> <none>
    kube-system pod/kube-proxy-hgrx8 1/1 Running 0 10h x.x.x..33 kw-04.bogus.local <none> <none>
    kube-system pod/kube-proxy-ljlsh 1/1 Running 0 10h x.x.x..31 kw-02.bogus.local <none> <none>
    kube-system pod/kube-scheduler-km-01.bogus.local 1/1 Running 5 20h x.x.x..25 km-01.bogus.local <none> <none>

    NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
    ag1 service/ag1-primary NodePort 10.104.183.81 x.x.x..30,x.x.x..31,x.x.x..32,x.x.x..33,x.x.x..34,x.x.x..35 1433:30405/TCP 85m role.ag.mssql.microsoft.com/ag1=primary,type=sqlservr
    ag1 service/ag1-secondary NodePort 10.102.52.31 x.x.x..30,x.x.x..31,x.x.x..32,x.x.x..33,x.x.x..34,x.x.x..35 1433:30713/TCP 85m role.ag.mssql.microsoft.com/ag1=secondary,type=sqlservr
    ag1 service/mssql1 NodePort 10.96.166.108 x.x.x..30,x.x.x..31,x.x.x..32,x.x.x..33,x.x.x..34,x.x.x..35 1433:32439/TCP 86m name=mssql1,type=sqlservr
    ag1 service/mssql2 NodePort 10.109.146.58 x.x.x..30,x.x.x..31,x.x.x..32,x.x.x..33,x.x.x..34,x.x.x..35 1433:30636/TCP 86m name=mssql2,type=sqlservr
    ag1 service/mssql3 NodePort 10.101.234.186 x.x.x..30,x.x.x..31,x.x.x..32,x.x.x..33,x.x.x..34,x.x.x..35 1433:30862/TCP 86m name=mssql3,type=sqlservr
    default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 23h <none>
    kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 20h k8s-app=kube-dns

    NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES SELECTOR
    kube-system daemonset.apps/kube-flannel-ds-amd64 7 7 7 7 7 <none> 20h kube-flannel quay.io/coreos/flannel:v0.12.0-amd64 app=flannel
    kube-system daemonset.apps/kube-flannel-ds-arm 0 0 0 0 0 <none> 20h kube-flannel quay.io/coreos/flannel:v0.12.0-arm app=flannel
    kube-system daemonset.apps/kube-flannel-ds-arm64 0 0 0 0 0 <none> 20h kube-flannel quay.io/coreos/flannel:v0.12.0-arm64 app=flannel
    kube-system daemonset.apps/kube-flannel-ds-ppc64le 0 0 0 0 0 <none> 20h kube-flannel quay.io/coreos/flannel:v0.12.0-ppc64le app=flannel
    kube-system daemonset.apps/kube-flannel-ds-s390x 0 0 0 0 0 <none> 20h kube-flannel quay.io/coreos/flannel:v0.12.0-s390x app=flannel
    kube-system daemonset.apps/kube-proxy 7 7 7 7 7 kubernetes.io/os=linux 20h kube-proxy k8s.gcr.io/kube-proxy:v1.18.7 k8s-app=kube-proxy

    NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
    ag1 deployment.apps/mssql-operator 1/1 1 1 86m mssql-operator mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu app=mssql-operator
    kube-system deployment.apps/coredns 2/2 2 2 20h coredns k8s.gcr.io/coredns:1.6.7 k8s-app=kube-dns

    NAMESPACE NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
    ag1 replicaset.apps/mssql-operator-68bcc684c4 1 1 1 86m mssql-operator mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu app=mssql-operator,pod-template-hash=68bcc684c4
    kube-system replicaset.apps/coredns-66bff467f8 2 2 2 20h coredns k8s.gcr.io/coredns:1.6.7 k8s-app=kube-dns,pod-template-hash=66bff467f8
    问题:有很多文章都在讨论 SQL2019 HA 构建。然而,似乎每个人都在云端,而我的则是在 Vsphere 环境中的本地部署。它们看起来很简单:按以下顺序运行 3 个脚本:operator.yaml、sql.yaml 和 ag-service.yaml。
    我的 YAML 基于: https://github.com/microsoft/sql-server-samples/tree/master/samples/features/high%20availability/Kubernetes/sample-manifest-files
    对于之后实际截图环境的博客,应该至少有 7 个 pod(1 个 Operator,3 个 SQL Init,3 个 SQL)。如果你看看我前面提到的 all --all-namespaces 输出,我拥有一切(并且处于运行状态),但除了正在运行的 Operator 之外没有其他 Pod ......?
    我实际上打破了控制平面回到单节点只是为了尝试隔离日志。/var/log/container/* 和/var/log/pod/* 不包含任何表明存储问题或 Pod 不存在的任何其他原因的值。可能还值得注意的是,我开始使用最新的 sql2019 标签:2019-latest 但是当我在那里得到相同的行为时,我决定尝试使用旧位,因为很多博客都基于 CTP 2.1。
    我可以使用 VCP 存储提供程序创建 PV 和 PVC。我有我的 Secrets 并且可以在 Secrets 商店中看到它们。
    我不知道为什么 pod 丢失了,或者在检查 journalctl、守护进程本身和/var/log 后应该在哪里看,我没有看到任何迹象表明甚至有人试图创建它们——kubectl 应用-f mssql-server2019.yaml 我改编的运行完成并且没有错误指示创建了 3 个 sql 对象和 3 个 sql 服务。但无论如何,这是针对 CTP2.1 的文件:
    cat << EOF > mssql-server2019.yaml
    apiVersion: mssql.microsoft.com/v1
    kind: SqlServer
    metadata:
    labels: {name: mssql1, type: sqlservr}
    name: mssql1
    namespace: ag1
    spec:
    acceptEula: true
    agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1
    availabilityGroups: [ag1]
    instanceRootVolumeClaimTemplate:
    accessModes: [ReadWriteOnce]
    resources:
    requests: {storage: 5Gi}
    storageClass: default
    saPassword:
    secretKeyRef: {key: sapassword, name: sql-secrets}
    sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1'}
    ---
    apiVersion: v1
    kind: Service
    metadata: {name: mssql1, namespace: ag1}
    spec:
    ports:
    - {name: tds, port: 1433}
    selector: {name: mssql1, type: sqlservr}
    type: NodePort
    externalIPs:
    - x.x.x.30
    - x.x.x.31
    - x.x.x.32
    - x.x.x.33
    - x.x.x.34
    - x.x.x.35
    ---
    apiVersion: mssql.microsoft.com/v1
    kind: SqlServer
    metadata:
    labels: {name: mssql2, type: sqlservr}
    name: mssql2
    namespace: ag1
    spec:
    acceptEula: true
    agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1
    availabilityGroups: [ag1]
    instanceRootVolumeClaimTemplate:
    accessModes: [ReadWriteOnce]
    resources:
    requests: {storage: 5Gi}
    storageClass: default
    saPassword:
    secretKeyRef: {key: sapassword, name: sql-secrets}
    sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1'}
    ---
    apiVersion: v1
    kind: Service
    metadata: {name: mssql2, namespace: ag1}
    spec:
    ports:
    - {name: tds, port: 1433}
    selector: {name: mssql2, type: sqlservr}
    type: NodePort
    externalIPs:
    - x.x.x.30
    - x.x.x.31
    - x.x.x.32
    - x.x.x.33
    - x.x.x.34
    - x.x.x.35
    ---
    apiVersion: mssql.microsoft.com/v1
    kind: SqlServer
    metadata:
    labels: {name: mssql3, type: sqlservr}
    name: mssql3
    namespace: ag1
    spec:
    acceptEula: true
    agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1
    availabilityGroups: [ag1]
    instanceRootVolumeClaimTemplate:
    accessModes: [ReadWriteOnce]
    resources:
    requests: {storage: 5Gi}
    storageClass: default
    saPassword:
    secretKeyRef: {key: sapassword, name: sql-secrets}
    sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1'}
    ---
    apiVersion: v1
    kind: Service
    metadata: {name: mssql3, namespace: ag1}
    spec:
    ports:
    - {name: tds, port: 1433}
    selector: {name: mssql3, type: sqlservr}
    type: NodePort
    externalIPs:
    - x.x.x.30
    - x.x.x.31
    - x.x.x.32
    - x.x.x.33
    - x.x.x.34
    - x.x.x.35
    ---
    EOF
    Edit1: kubectl logs -n ag mssql-operator-*
    [sqlservers] 2020/08/14 14:36:48 Creating custom resource definition
    [sqlservers] 2020/08/14 14:36:48 Created custom resource definition
    [sqlservers] 2020/08/14 14:36:48 Waiting for custom resource definition to be available
    [sqlservers] 2020/08/14 14:36:49 Watching for resources...
    [sqlservers] 2020/08/14 14:37:08 Creating ConfigMap sql-operator
    [sqlservers] 2020/08/14 14:37:08 Updating mssql1 in namespace ag1 ...
    [sqlservers] 2020/08/14 14:37:08 Creating ConfigMap ag1
    [sqlservers] ERROR: 2020/08/14 14:37:08 could not process update request: error creating ConfigMap ag1: v1.ConfigMap: ObjectMeta: v1.ObjectMeta: readObjectFieldAsBytes: expect : after object field, parsing 627 ...:{},"k:{\"... at {"kind":"ConfigMap","apiVersion":"v1","metadata":{"name":"ag1","namespace":"ag1","selfLink":"/api/v1/namespaces/ag1/configmaps/ag1","uid":"33af6232-4464-4290-bb14-b21e8f72e361","resourceVersion":"314186","creationTimestamp":"2020-08-14T14:37:08Z","ownerReferences":[{"apiVersion":"mssql.microsoft.com/v1","kind":"ReplicationController","name":"mssql1","uid":"e71a7246-2776-4d96-9735-844ee136a37d","controller":false}],"managedFields":[{"manager":"mssql-server-k8s-operator","operation":"Update","apiVersion":"v1","time":"2020-08-14T14:37:08Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:ownerReferences":{".":{},"k:{\"uid\":\"e71a7246-2776-4d96-9735-844ee136a37d\"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}}}}]}}
    [sqlservers] 2020/08/14 14:37:08 Updating ConfigMap sql-operator
    [sqlservers] 2020/08/14 14:37:08 Updating mssql2 in namespace ag1 ...
    [sqlservers] ERROR: 2020/08/14 14:37:08 could not process update request: error getting ConfigMap ag1: v1.ConfigMap: ObjectMeta: v1.ObjectMeta: readObjectFieldAsBytes: expect : after object field, parsing 627 ...:{},"k:{\"... at {"kind":"ConfigMap","apiVersion":"v1","metadata":{"name":"ag1","namespace":"ag1","selfLink":"/api/v1/namespaces/ag1/configmaps/ag1","uid":"33af6232-4464-4290-bb14-b21e8f72e361","resourceVersion":"314186","creationTimestamp":"2020-08-14T14:37:08Z","ownerReferences":[{"apiVersion":"mssql.microsoft.com/v1","kind":"ReplicationController","name":"mssql1","uid":"e71a7246-2776-4d96-9735-844ee136a37d","controller":false}],"managedFields":[{"manager":"mssql-server-k8s-operator","operation":"Update","apiVersion":"v1","time":"2020-08-14T14:37:08Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:ownerReferences":{".":{},"k:{\"uid\":\"e71a7246-2776-4d96-9735-844ee136a37d\"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}}}}]}}
    [sqlservers] 2020/08/14 14:37:08 Updating ConfigMap sql-operator
    [sqlservers] 2020/08/14 14:37:08 Updating mssql3 in namespace ag1 ...
    [sqlservers] ERROR: 2020/08/14 14:37:08 could not process update request: error getting ConfigMap ag1: v1.ConfigMap: ObjectMeta: v1.ObjectMeta: readObjectFieldAsBytes: expect : after object field, parsing 627 ...:{},"k:{\"... at {"kind":"ConfigMap","apiVersion":"v1","metadata":{"name":"ag1","namespace":"ag1","selfLink":"/api/v1/namespaces/ag1/configmaps/ag1","uid":"33af6232-4464-4290-bb14-b21e8f72e361","resourceVersion":"314186","creationTimestamp":"2020-08-14T14:37:08Z","ownerReferences":[{"apiVersion":"mssql.microsoft.com/v1","kind":"ReplicationController","name":"mssql1","uid":"e71a7246-2776-4d96-9735-844ee136a37d","controller":false}],"managedFields":[{"manager":"mssql-server-k8s-operator","operation":"Update","apiVersion":"v1","time":"2020-08-14T14:37:08Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:ownerReferences":{".":{},"k:{\"uid\":\"e71a7246-2776-4d96-9735-844ee136a37d\"}":{".":{},"f:apiVersion":{},"f:controller":{},"f:kind":{},"f:name":{},"f:uid":{}}}}}}]}}
    我查看了我的 operator 和 mssql2019.yamls(特别是围绕那种:SqlServer,因为这似乎是它失败的地方)并且无法识别任何明显的不一致或差异。

    最佳答案

    所以你的运营商正在运行:

    ag1           pod/pod/mssql-operator-68bcc684c4-rbzvn                   1/1     Running   0          86m   10.10.4.133   kw-02.bogus.local   <none>           <none>
    我将首先查看那里的日志:
    kubectl -n ag1 logs pod/mssql-operator-68bcc684c4-rbzvn
    它很可能需要与云提供商(即 Azure)进行交互,并且不支持 VMware,但请检查日志内容 👀。
    更新:
    根据您发布的日志,您似乎使用的是 K8s 1.18,并且运营商不兼容。它正在尝试使用 kube-apiserver 拒绝的规范创建一个 ConfigMap。
    ✌️

    关于docker - K8s SQL2019 HA 容器 - 伙计,我的 Pod 在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63405840/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com