在AWS上使用K8引发有状态集群设置问题

时间:2019-02-16 16:37:12

标签: kubernetes ignite amazon-eks

我正在尝试在aws上创建点火集群,但是遇到了一些麻烦。我的豆荚没有上。 我已经关注了有关在AWS EKS上进行有状态kubernetes部署的ignite官方文档,但是在创建ignite集群时,我看到pod的创建处于挂起状态。

我创建了两个单独的文件,一个用于持久性存储,一个用于wal存储。 [用于WAL的单独磁盘]

我看到存储已创建:

    ➜  ignite-configs kubectl get sc
    NAME                               PROVISIONER             AGE

    ignite-persistence-storage-class   kubernetes.io/aws-ebs   3h
    ignite-wal-storage-class           kubernetes.io/aws-ebs   3h

    ➜  ignite-configs kubectl describe pod ignite-0
    Name:               ignite-0
    Namespace:          angus-ignite-dev
    Priority:           0
    PriorityClassName:  <none>
    Node:               <none>
    Labels:             app=ignite
                        controller-revision-hash=ignite-76f754f985
                        statefulset.kubernetes.io/pod-name=ignite-0
    Annotations:        <none>
    Status:             Pending
    IP:
    Controlled By:      StatefulSet/ignite
    Containers:
      ignite:
        Image:       apacheignite/ignite:2.6.0
        Ports:       11211/TCP, 47100/TCP, 47500/TCP, 49112/TCP, 10800/TCP, 8080/TCP, 10900/TCP
        Host Ports:  0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP
        Environment:
          OPTION_LIBS:   ignite-kubernetes,ignite-rest-http
          CONFIG_URI:    https://s3.amazonaws.com/009my-bucket009/example-kube-persistence-and-wal.xml
          IGNITE_QUIET:  false
          JVM_OPTS:      -Djava.net.preferIPv4Stack=true
        Mounts:
          /persistence from ignite-persistence (rw)
          /var/run/secrets/kubernetes.io/serviceaccount from ignite-token-h6m7b (ro)
          /wal from ignite-wal (rw)
    Conditions:
      Type           Status
      PodScheduled   False
    Volumes:
      ignite-persistence:
        Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
        ClaimName:  ignite-persistence-ignite-0
        ReadOnly:   false
      ignite-wal:
        Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
        ClaimName:  ignite-wal-ignite-0
        ReadOnly:   false
      ignite-token-h6m7b:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  ignite-token-h6m7b
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                     node.kubernetes.io/unreachable:NoExecute for 300s
    Events:



      Type     Reason            Age                       From               Message
      ----     ------            ----                      ----               -------
      Warning  FailedScheduling  2m23s (x12033 over 107m)  default-scheduler  pod has unbound PersistentVolumeClaims (repeated 15 times)

====================

Here are my ignite config files:

ignite-persistence-storage-class.yaml
=====================================

#Amazon AWS Configuration
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ignite-persistence-storage-class  #StorageClass name
  namespace: angus-ignite-dev         #Ignite namespace
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2 #Volume type io1, gp2, sc1, st1. Default: gp2
  zones: us-west-2

================================================ ============ 这是我用于日志和持久性的存储Yaml文件:

ignite-wal-storage-class.yaml

#Amazon AWS Configuration
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: ignite-wal-storage-class  #StorageClass name
  namespace: angus-ignite-dev #Ignite namespace
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2 #Volume type io1, gp2, sc1, st1. Default: gp2
  zones: us-west-2

================================================ ======================= 这是我的ignite statefulset创建yaml文件:

我对PV和PVC有一些疑问。我必须在某个地方声明它们吗?

apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: ignite
  namespace: angus-ignite-dev
spec:
  selector:
    matchLabels:
      app: ignite
  serviceName: ignite
  replicas: 2
  template:
    metadata:
      labels:
        app: ignite
    spec:
      serviceAccountName: ignite
      containers:
      - name: ignite
        image: apacheignite/ignite:2.6.0
        env:
        - name: OPTION_LIBS
          value: ignite-kubernetes,ignite-rest-http
        - name: CONFIG_URI
          value: https://s3.amazonaws.com/009my-bucket009/example-kube-persistence-and-wal.xml
        - name: IGNITE_QUIET
          value: "false"
        - name: JVM_OPTS
          value: "-Djava.net.preferIPv4Stack=true"
        ports:
        - containerPort: 11211 # JDBC port number.
        - containerPort: 47100 # communication SPI port number.
        - containerPort: 47500 # discovery SPI port number.
        - containerPort: 49112 # JMX port number.
        - containerPort: 10800 # SQL port number.
        - containerPort: 8080 # REST port number.
        - containerPort: 10900 #Thin clients port number.
        volumeMounts:
        - mountPath: "/wal"
          name: ignite-wal
        - mountPath: "/persistence"
          name: ignite-persistence
  volumeClaimTemplates:
  - metadata:
      name: ignite-persistence
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "ignite-persistence-storage-class"
      resources:
        requests:
          storage: "100Gi"
  - metadata:
      name: ignite-wal
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "ignite-wal-storage-class"
      resources:
        requests:
          storage: "100Gi"

1 个答案:

答案 0 :(得分:0)

对于 Kubernetes 1.19 及更高版本,使用 VolumeClaimTemplate 和 StateFulSets 将创建 PersistentVolumeClaim 和 PersistentVolume(提供的动态配置已由管理员设置)。

因此,如果您使用 VolumeClaimTemplate,则无需创建单独的 PV 和 PVC。