Kubernetes k8s中显示未知HPA

Kubernetes k8s中显示未知HPA,kubernetes,hpa,Kubernetes,Hpa,我使用如下所示的命令配置了HPA kubectl autoscale deployment isamruntime-v1 --cpu-percent=20 --min=1 --max=3 --namespace=default horizontalpodautoscaler.autoscaling/isamruntime-v1 autoscaled 但是,HPA无法识别CPU负载 pranam@UNKNOWN kubernetes % kubectl get hpa

我使用如下所示的命令配置了HPA

kubectl autoscale deployment isamruntime-v1 --cpu-percent=20 --min=1 --max=3 --namespace=default           
horizontalpodautoscaler.autoscaling/isamruntime-v1 autoscaled
但是,HPA无法识别CPU负载

pranam@UNKNOWN kubernetes % kubectl get hpa                                                                                 
NAME             REFERENCE                   TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
isamruntime-v1   Deployment/isamruntime-v1   <unknown>/20%   1         3         0          3s

我可以看到metrics服务器

pranam@UNKNOWN kubernetes % kubectl get pods -o wide --namespace=kube-system 
NAME                                                  READY   STATUS    RESTARTS   AGE     IP               NODE           NOMINATED NODE   READINESS GATES
calico-kube-controllers-7d88b45844-lz8zw              1/1     Running   0          22d     10.164.27.28     10.164.27.28   <none>           <none>
calico-node-bsx6p                                     1/1     Running   0          8d      10.164.27.39     10.164.27.39   <none>           <none>
calico-node-g229m                                     1/1     Running   0          8d      10.164.27.46     10.164.27.46   <none>           <none>
calico-node-slwrh                                     1/1     Running   0          22d     10.164.27.28     10.164.27.28   <none>           <none>
calico-node-tztjg                                     1/1     Running   0          8d      10.164.27.44     10.164.27.44   <none>           <none>
coredns-7d6bb98ccc-d8nrs                              1/1     Running   0          25d     172.30.93.205    10.164.27.28   <none>           <none>
coredns-7d6bb98ccc-n28dm                              1/1     Running   0          25d     172.30.93.204    10.164.27.28   <none>           <none>
coredns-7d6bb98ccc-zx5jx                              1/1     Running   0          25d     172.30.93.197    10.164.27.28   <none>           <none>
coredns-autoscaler-848db65fc6-lnfvf                   1/1     Running   0          25d     172.30.93.201    10.164.27.28   <none>           <none>
dashboard-metrics-scraper-576c46d9bd-k6z85            1/1     Running   0          25d     172.30.93.195    10.164.27.28   <none>           <none>
ibm-file-plugin-7c57965855-494bz                      1/1     Running   0          22d     172.30.93.216    10.164.27.28   <none>           <none>
ibm-iks-cluster-autoscaler-7df84fb95c-fhtgv           1/1     Running   0          2d23h   172.30.137.98    10.164.27.46   <none>           <none>
ibm-keepalived-watcher-9w4gb                          1/1     Running   0          8d      10.164.27.39     10.164.27.39   <none>           <none>
ibm-keepalived-watcher-ps5zm                          1/1     Running   0          8d      10.164.27.46     10.164.27.46   <none>           <none>
ibm-keepalived-watcher-rzxbs                          1/1     Running   0          8d      10.164.27.44     10.164.27.44   <none>           <none>
ibm-keepalived-watcher-w6mxb                          1/1     Running   0          25d     10.164.27.28     10.164.27.28   <none>           <none>
ibm-master-proxy-static-10.164.27.28                  2/2     Running   0          25d     10.164.27.28     10.164.27.28   <none>           <none>
ibm-master-proxy-static-10.164.27.39                  2/2     Running   0          8d      10.164.27.39     10.164.27.39   <none>           <none>
ibm-master-proxy-static-10.164.27.44                  2/2     Running   0          8d      10.164.27.44     10.164.27.44   <none>           <none>
ibm-master-proxy-static-10.164.27.46                  2/2     Running   0          8d      10.164.27.46     10.164.27.46   <none>           <none>
ibm-storage-watcher-67466b969f-ps55m                  1/1     Running   0          22d     172.30.93.217    10.164.27.28   <none>           <none>
kubernetes-dashboard-c6b4b9d77-27zwb                  1/1     Running   2          22d     172.30.93.218    10.164.27.28   <none>           <none>
metrics-server-79d847cf58-6frsf                       2/2     Running   0          3m23s   172.30.93.226    10.164.27.28   <none>           <none>
public-crbro6um6l04jalpqrsl5g-alb1-8465f75bb4-88vl5   4/4     Running   0          11h     172.30.93.225    10.164.27.28   <none>           <none>
public-crbro6um6l04jalpqrsl5g-alb1-8465f75bb4-vx68d   4/4     Running   0          11h     172.30.137.104   10.164.27.46   <none>           <none>
vpn-58b48cdc7c-4lp9c                                  1/1     Running   0          25d     172.30.93.193    10.164.27.28   <none>           <none>
我的YAML文件是

#Assumes create-docker-store-secret.sh used to create dockerlogin secret
#Assumes create-secrets.sh used to create key file, sam admin, and cfgsvc secrets
apiVersion: storage.k8s.io/v1beta1
# Create StorageClass with gidallocate=true to allow non-root user access to mount
# This is used by PostgreSQL container
kind: StorageClass
metadata:
   name: ibmc-file-bronze-gid
   labels:
     kubernetes.io/cluster-service: "true"
provisioner: ibm.io/ibmc-file
parameters:
   type: "Endurance"
   iopsPerGB: "2"
   sizeRange: "[1-12000]Gi"
   mountOptions: nfsvers=4.1,hard
   billingType: "hourly"
   reclaimPolicy: "Delete"
   classVersion: "2"
   gidAllocate: "true"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldaplib
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldapslapd
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldapsecauthority
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgresqldata
spec:
  storageClassName: ibmc-file-bronze-gid
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: isamconfig
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: openldap
  labels:
    app: openldap
spec:
  selector:
    matchLabels:
      app: openldap
  replicas: 1
  template:
    metadata:
      labels:
        app: openldap
    spec:
      volumes:
        - name: ldaplib
          persistentVolumeClaim:
            claimName: ldaplib
        - name: ldapslapd
          persistentVolumeClaim:
            claimName: ldapslapd
        - name: ldapsecauthority
          persistentVolumeClaim:
            claimName: ldapsecauthority
        - name: openldap-keys
          secret:
            secretName: openldap-keys
      containers:
        - name: openldap
          image: ibmcom/isam-openldap:9.0.7.0
          ports:
            - containerPort: 636
          env:
            - name: LDAP_DOMAIN
              value: ibm.com
            - name: LDAP_ADMIN_PASSWORD
              value: Passw0rd
            - name: LDAP_CONFIG_PASSWORD
              value: Passw0rd
          volumeMounts:
            - mountPath: /var/lib/ldap
              name: ldaplib
            - mountPath: /etc/ldap/slapd.d
              name: ldapslapd
            - mountPath: /var/lib/ldap.secAuthority
              name: ldapsecauthority
            - mountPath: /container/service/slapd/assets/certs
              name: openldap-keys
# This line is needed when running on Kubernetes 1.9.4 or above
          args: [ "--copy-service"]

# useful for debugging startup issues - can run bash, then exec to the container and poke around
#          command: [ "/bin/bash"]
#          args: [ "-c", "while /bin/true ; do sleep 5; done" ]
# Just this line to get debug output from openldap startup
#          args: [ "--loglevel" , "trace","--copy-service"]
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: openldap
  labels:
    app: openldap
spec:
  ports:
    - port: 636
      name: ldaps
      protocol: TCP
  selector:
    app: openldap
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgresql
  labels:
    app: postgresql
spec:
  selector:
    matchLabels:
      app: postgresql
  replicas: 1
  template:
    metadata:
      labels:
        app: postgresql
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 70
        fsGroup: 0
      volumes:
        - name: postgresqldata
          persistentVolumeClaim:
            claimName: postgresqldata
        - name: postgresql-keys
          secret:
            secretName: postgresql-keys
      containers:
        - name: postgresql
          image: ibmcom/isam-postgresql:9.0.7.0
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_USER
              value: postgres
            - name: POSTGRES_PASSWORD
              value: Passw0rd
            - name: POSTGRES_DB
              value: isam
            - name: POSTGRES_SSL_KEYDB
              value: /var/local/server.pem
            - name: PGDATA
              value: /var/lib/postgresql/data/db-files/
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresqldata
            - mountPath: /var/local
              name: postgresql-keys
# useful for debugging startup issues - can run bash, then exec to the container and poke around
#          command: [ "/bin/bash"]
#          args: [ "-c", "while /bin/true ; do sleep 5; done" ]
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: postgresql
spec:
  ports:
    - port: 5432
      name: postgresql
      protocol: TCP
  selector:
    app: postgresql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamconfig
  labels:
    app: isamconfig
spec:
  selector:
    matchLabels:
      app: isamconfig
  replicas: 1
  template:
    metadata:
      labels:
        app: isamconfig
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          persistentVolumeClaim:
            claimName: isamconfig
        - name: isamconfig-logs
          emptyDir: {}
      containers:
        - name: isamconfig
          image: ibmcom/isam:9.0.7.1_IF4
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamconfig-logs
          env:
            - name: SERVICE
              value: config
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: ADMIN_PWD
              valueFrom:
                secretKeyRef:
                  name: samadmin
                  key: adminpw
          readinessProbe:
            tcpSocket:
              port:  9443
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 9443
            initialDelaySeconds: 120
            periodSeconds: 20
#          command: [ "/sbin/bootstrap.sh" ]
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamconfig
spec:
# To make the LMI internet facing, make it a NodePort
  type: NodePort
  ports:
    - port: 9443
      name: isamconfig
      protocol: TCP
# make this one statically allocated
      nodePort: 30442
  selector:
    app: isamconfig
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrprp1-v1
  labels:
    app: isamwrprp1
spec:
  selector:
    matchLabels:
      app: isamwrprp1
      version: v1
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrprp1
        version: v1
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrprp1-logs
          emptyDir: {}
      containers:
        - name: isamwrprp1
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrprp1-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: rp1
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrprp1-v2
  labels:
    app: isamwrprp1
spec:
  selector:
    matchLabels:
      app: isamwrprp1
      version: v2
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrprp1
        version: v2
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrprp1-logs
          emptyDir: {}
      containers:
        - name: isamwrprp1
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrprp1-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: rp1
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamwrprp1
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
    - port: 443
      name: isamwrprp1
      protocol: TCP
      nodePort: 30443
  selector:
    app: isamwrprp1
---
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrpmobile
  labels:
    app: isamwrpmobile
spec:
  selector:
    matchLabels:
      app: isamwrpmobile
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrpmobile
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrpmobile-logs
          emptyDir: {}
      containers:
        - name: isamwrpmobile
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrpmobile-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: mobile
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamwrpmobile
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
    - port: 443
      name: isamwrpmobile
      protocol: TCP
      nodePort: 30444
  selector:
    app: isamwrpmobile
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamruntime-v1
  labels:
    app: isamruntime
spec:
  selector:
    matchLabels:
      app: isamruntime
      version: v1
  replicas: 1
  template:
    metadata:
      labels:
        app: isamruntime
        version: v1
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamruntime-logs
          emptyDir: {}
      containers:
        - name: isamruntime
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamruntime-logs
          env:
            - name: SERVICE
              value: runtime
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamruntime-v2
  labels:
    app: isamruntime
spec:
  selector:
    matchLabels:
      app: isamruntime
      version: v2
  replicas: 1
  template:
    metadata:
      labels:
        app: isamruntime
        version: v2
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamruntime-logs
          emptyDir: {}
      containers:
        - name: isamruntime
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamruntime-logs
          env:
            - name: SERVICE
              value: runtime
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
apiVersion: v1
kind: Service
metadata:
  name: isamruntime
spec:
  ports:
    - port: 443
      name: isamruntime
      protocol: TCP
  selector:
    app: isamruntime
---

我不知道为什么CPU负载显示为未知。我是否错过了一步或犯了错误?有人能帮忙吗

问候
Pranam

在定义应用程序的部署时,是否指定了
资源
块? 我不记得是在哪里说的,但我有一次遇到这个案子,当时我忘了


有关管理容器资源的详细信息:

根据显示的问题,您似乎没有在delployment.yaml文件中设置资源限制

如果您执行
kubectl explain deployment
,那么您将看到in-containers规范-

resources:
   limits:
      cpu:
      memory:
   requests:
      cpu:
      memory:

如果您向上述密钥添加值,那么hpa问题肯定会得到解决。

hpa pod的共享日志描述度量服务器pod和共享输出?您能显示您的deployment.yaml文件吗?@TusharMahajan我已将yaml文件添加到我的上述问题中。如果您不设置限制,请认可它,HPA没有用于比较请求的引用,因为没有定义限制,它是未知的。
#Assumes create-docker-store-secret.sh used to create dockerlogin secret
#Assumes create-secrets.sh used to create key file, sam admin, and cfgsvc secrets
apiVersion: storage.k8s.io/v1beta1
# Create StorageClass with gidallocate=true to allow non-root user access to mount
# This is used by PostgreSQL container
kind: StorageClass
metadata:
   name: ibmc-file-bronze-gid
   labels:
     kubernetes.io/cluster-service: "true"
provisioner: ibm.io/ibmc-file
parameters:
   type: "Endurance"
   iopsPerGB: "2"
   sizeRange: "[1-12000]Gi"
   mountOptions: nfsvers=4.1,hard
   billingType: "hourly"
   reclaimPolicy: "Delete"
   classVersion: "2"
   gidAllocate: "true"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldaplib
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldapslapd
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ldapsecauthority
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgresqldata
spec:
  storageClassName: ibmc-file-bronze-gid
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: isamconfig
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50M
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: openldap
  labels:
    app: openldap
spec:
  selector:
    matchLabels:
      app: openldap
  replicas: 1
  template:
    metadata:
      labels:
        app: openldap
    spec:
      volumes:
        - name: ldaplib
          persistentVolumeClaim:
            claimName: ldaplib
        - name: ldapslapd
          persistentVolumeClaim:
            claimName: ldapslapd
        - name: ldapsecauthority
          persistentVolumeClaim:
            claimName: ldapsecauthority
        - name: openldap-keys
          secret:
            secretName: openldap-keys
      containers:
        - name: openldap
          image: ibmcom/isam-openldap:9.0.7.0
          ports:
            - containerPort: 636
          env:
            - name: LDAP_DOMAIN
              value: ibm.com
            - name: LDAP_ADMIN_PASSWORD
              value: Passw0rd
            - name: LDAP_CONFIG_PASSWORD
              value: Passw0rd
          volumeMounts:
            - mountPath: /var/lib/ldap
              name: ldaplib
            - mountPath: /etc/ldap/slapd.d
              name: ldapslapd
            - mountPath: /var/lib/ldap.secAuthority
              name: ldapsecauthority
            - mountPath: /container/service/slapd/assets/certs
              name: openldap-keys
# This line is needed when running on Kubernetes 1.9.4 or above
          args: [ "--copy-service"]

# useful for debugging startup issues - can run bash, then exec to the container and poke around
#          command: [ "/bin/bash"]
#          args: [ "-c", "while /bin/true ; do sleep 5; done" ]
# Just this line to get debug output from openldap startup
#          args: [ "--loglevel" , "trace","--copy-service"]
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: openldap
  labels:
    app: openldap
spec:
  ports:
    - port: 636
      name: ldaps
      protocol: TCP
  selector:
    app: openldap
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgresql
  labels:
    app: postgresql
spec:
  selector:
    matchLabels:
      app: postgresql
  replicas: 1
  template:
    metadata:
      labels:
        app: postgresql
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 70
        fsGroup: 0
      volumes:
        - name: postgresqldata
          persistentVolumeClaim:
            claimName: postgresqldata
        - name: postgresql-keys
          secret:
            secretName: postgresql-keys
      containers:
        - name: postgresql
          image: ibmcom/isam-postgresql:9.0.7.0
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_USER
              value: postgres
            - name: POSTGRES_PASSWORD
              value: Passw0rd
            - name: POSTGRES_DB
              value: isam
            - name: POSTGRES_SSL_KEYDB
              value: /var/local/server.pem
            - name: PGDATA
              value: /var/lib/postgresql/data/db-files/
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresqldata
            - mountPath: /var/local
              name: postgresql-keys
# useful for debugging startup issues - can run bash, then exec to the container and poke around
#          command: [ "/bin/bash"]
#          args: [ "-c", "while /bin/true ; do sleep 5; done" ]
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: postgresql
spec:
  ports:
    - port: 5432
      name: postgresql
      protocol: TCP
  selector:
    app: postgresql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamconfig
  labels:
    app: isamconfig
spec:
  selector:
    matchLabels:
      app: isamconfig
  replicas: 1
  template:
    metadata:
      labels:
        app: isamconfig
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          persistentVolumeClaim:
            claimName: isamconfig
        - name: isamconfig-logs
          emptyDir: {}
      containers:
        - name: isamconfig
          image: ibmcom/isam:9.0.7.1_IF4
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamconfig-logs
          env:
            - name: SERVICE
              value: config
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: ADMIN_PWD
              valueFrom:
                secretKeyRef:
                  name: samadmin
                  key: adminpw
          readinessProbe:
            tcpSocket:
              port:  9443
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 9443
            initialDelaySeconds: 120
            periodSeconds: 20
#          command: [ "/sbin/bootstrap.sh" ]
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamconfig
spec:
# To make the LMI internet facing, make it a NodePort
  type: NodePort
  ports:
    - port: 9443
      name: isamconfig
      protocol: TCP
# make this one statically allocated
      nodePort: 30442
  selector:
    app: isamconfig
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrprp1-v1
  labels:
    app: isamwrprp1
spec:
  selector:
    matchLabels:
      app: isamwrprp1
      version: v1
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrprp1
        version: v1
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrprp1-logs
          emptyDir: {}
      containers:
        - name: isamwrprp1
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrprp1-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: rp1
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrprp1-v2
  labels:
    app: isamwrprp1
spec:
  selector:
    matchLabels:
      app: isamwrprp1
      version: v2
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrprp1
        version: v2
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrprp1-logs
          emptyDir: {}
      containers:
        - name: isamwrprp1
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrprp1-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: rp1
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamwrprp1
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
    - port: 443
      name: isamwrprp1
      protocol: TCP
      nodePort: 30443
  selector:
    app: isamwrprp1
---
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamwrpmobile
  labels:
    app: isamwrpmobile
spec:
  selector:
    matchLabels:
      app: isamwrpmobile
  replicas: 1
  template:
    metadata:
      labels:
        app: isamwrpmobile
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamwrpmobile-logs
          emptyDir: {}
      containers:
        - name: isamwrpmobile
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamwrpmobile-logs
          env:
            - name: SERVICE
              value: webseal
            - name: INSTANCE
              value: mobile
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
# for external service access, see https://console.bluemix.net/docs/containers/cs_apps.html#cs_apps_public_nodeport
apiVersion: v1
kind: Service
metadata:
  name: isamwrpmobile
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
    - port: 443
      name: isamwrpmobile
      protocol: TCP
      nodePort: 30444
  selector:
    app: isamwrpmobile
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamruntime-v1
  labels:
    app: isamruntime
spec:
  selector:
    matchLabels:
      app: isamruntime
      version: v1
  replicas: 1
  template:
    metadata:
      labels:
        app: isamruntime
        version: v1
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamruntime-logs
          emptyDir: {}
      containers:
        - name: isamruntime
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamruntime-logs
          env:
            - name: SERVICE
              value: runtime
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: isamruntime-v2
  labels:
    app: isamruntime
spec:
  selector:
    matchLabels:
      app: isamruntime
      version: v2
  replicas: 1
  template:
    metadata:
      labels:
        app: isamruntime
        version: v2
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser:    6000
      volumes:
        - name: isamconfig
          emptyDir: {}
        - name: isamruntime-logs
          emptyDir: {}
      containers:
        - name: isamruntime
          image: ibmcom/isam:9.0.7.1_IF4
          ports:
            - containerPort: 443
          volumeMounts:
            - mountPath: /var/shared
              name: isamconfig
            - mountPath: /var/application.logs
              name: isamruntime-logs
          env:
            - name: SERVICE
              value: runtime
            - name: CONTAINER_TIMEZONE
              value: Europe/London
            - name: AUTO_RELOAD_FREQUENCY
              value: "5"
            - name: CONFIG_SERVICE_URL
              value: https://isamconfig:9443/shared_volume
            - name: CONFIG_SERVICE_USER_NAME
              value: cfgsvc
            - name: CONFIG_SERVICE_USER_PWD
              valueFrom:
                secretKeyRef:
                  name: configreader
                  key: cfgsvcpw
          livenessProbe:
            exec:
              command:
              - /sbin/health_check.sh
              - livenessProbe
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
          readinessProbe:
            exec:
              command:
              - /sbin/health_check.sh
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 2
      imagePullSecrets:
        - name: dockerlogin
---
apiVersion: v1
kind: Service
metadata:
  name: isamruntime
spec:
  ports:
    - port: 443
      name: isamruntime
      protocol: TCP
  selector:
    app: isamruntime
---

resources:
   limits:
      cpu:
      memory:
   requests:
      cpu:
      memory: