Anthos:迁移到容器 - Bank of Anthos 应用程序

问题描述

关于 Anthos:迁移到容器 - Anthos 银行应用

我正在尝试迁移 anthos 应用程序库 https://github.com/GoogleCloudPlatform/bank-of-anthos/

我已经在 GCP VM 上安装了相同的单体服务并尝试将其迁移到微服务。但是在进行迁移时,容器并没有出现,如果有人之前测试过此迁移并且可以帮助进行部署规范所需的修改,那将会很有帮助。

以下是生成的工件 ------------部署-规范-yaml------------

# Stateful application specification
apiVersion: apps/v1
kind: StatefulSet
Metadata:
  creationTimestamp: null
  labels:
    app: ledgermonolith-service
    migrate-for-anthos-optimization: "true"
    migrate-for-anthos-version: v1.6.0
  name: ledgermonolith-service
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ledgermonolith-service
      migrate-for-anthos-optimization: "true"
      migrate-for-anthos-version: v1.6.0
  serviceName: ledgermonolith-service
  template:
    Metadata:
      creationTimestamp: null
      labels:
        app: ledgermonolith-service
        migrate-for-anthos-optimization: "true"
        migrate-for-anthos-version: v1.6.0
    spec:
      containers:
      - image: gcr.io/cloud-devops/ledgermonolith-service:3-2-2021--9-31-21
        name: ledgermonolith-service
        readinessProbe:
          exec:
            command:
            - /code/ready.sh
        resources: {}
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /sys/fs/cgroup
          name: cgroups
        - mountPath: /opt/monolith
          name: data-pvc-0-651cc989-532a-4d22-ab98-288a8a9ef494
          subPath: opt/monolith
      volumes:
      - hostPath:
          path: /sys/fs/cgroup
          type: Directory
        name: cgroups
      - name: data-pvc-0-651cc989-532a-4d22-ab98-288a8a9ef494
        persistentVolumeClaim:
          claimName: data-pvc-0-651cc989-532a-4d22-ab98-288a8a9ef494
  updateStrategy: {}
status:
  replicas: 0

---
# Headless Service specification -
# No load-balancing,and a single cluster internal IP,only reachable from within the cluster
# The Kubernetes endpoints controller will modify the DNS configuration to return records (addresses) that point to the Pods,which are labeled with "app": "ledgermonolith-service"
apiVersion: v1
kind: Service
Metadata:
  creationTimestamp: null
  name: ledgermonolith-service
spec:
  clusterIP: None
  selector:
    app: ledgermonolith-service
  type: ClusterIP
status:
  loadBalancer: {}

---

---
apiVersion: v1
kind: PersistentVolumeClaim
Metadata:
  creationTimestamp: null
  labels:
    migration: zukeyyvw
    migration-name: boa-migration
    migration-namespace: v2k-system
  name: data-pvc-0-651cc989-532a-4d22-ab98-288a8a9ef494
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10G
  storageClassName: ""
  volumeMode: Filesystem
  volumeName: pvc-b5a7ccbf-a8c1-4ca0-b380-289fc7322502
status: {}

---
apiVersion: v1
kind: PersistentVolume
Metadata:
  creationTimestamp: null
  labels:
    failure-domain.beta.kubernetes.io/region: us-west1
    failure-domain.beta.kubernetes.io/zone: us-west1-a
  name: pvc-b5a7ccbf-a8c1-4ca0-b380-289fc7322502
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 10Gi
  gcePersistentdisk:
    fsType: ext4
    pdName: gke-migration-processi-pvc-b5a7ccbf-a8c1-4ca0-b380-289fc7322502
  nodeAffinity:
    required:
      nodeselectorTerms:
      - matchExpressions:
        - key: failure-domain.beta.kubernetes.io/region
          operator: In
          values:
          - us-west1
        - key: failure-domain.beta.kubernetes.io/zone
          operator: In
          values:
          - us-west1-a
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
status: {}

-----------Pod 日志---------------------------

Containers:
  ledgermonolith-service:
    Container ID:   docker://6c48cff783bd4c13be0ad58acd2ad6cf3cc649dfba4296f9395228071aa51
    Image:          gcr.io/cloud-devops/ledgermonolith-service:3-2-2021--9-31-21
    Image ID:       docker-pullable://gcr.io/cloud-devops-298213/ledgermonolith-service@sha256:ffda99921294de29a03dcaebe0e2b783bf27a551fe449e90b9ed35d53746
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Message:      Invalid system or AppArmor profile
      Exit Code:    1
      Started:      Thu,04 Mar 2021 13:44:45 +0000
      Finished:     Thu,04 Mar 2021 13:44:47 +0000
    Ready:          False
    Restart Count:  605
    Readiness:      exec [/code/ready.sh] delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:    <none>
    Mounts:
      /opt/monolith from data-pvc-0-651cc989-532a-4d22-ab98-288a8a9ef494 (rw,path="opt/monolith")
      /sys/fs/cgroup from cgroups (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-(ro)

----------pod 事件日志------------

Events:
  Type     Reason   Age                     From     Message
  ----     ------   ----                    ----     -------
  normal   Pulled   21m (x601 over 2d3h)    kubelet  Container image "gcr.io/cloud-devops/ledgermonolith-service:3-2-2021--9-31-21" already present on machine
  Warning  BackOff  83s (x14099 over 2d3h)  kubelet  Back-off restarting Failed container

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)