2019年7月31日水曜日

yaml形式で特定のpodを出力する。

# kubectl get pod -l app -L app
NAME                               READY   STATUS              RESTARTS   AGE     APP
db-nc-767d7b6b89-ld5v6             1/1     Running             0          2m42s   db
myapp-d7dbd6858-dxfkq              1/1     Running             0          44h     myapp
myapp-d7dbd6858-rk9p8              1/1     Running             0          44h     myapp
myapp-d7dbd6858-sjkkx              1/1     Running             0          44h     myapp
nc-7c68f6f7df-h8d6n                0/1     ContainerCreating   0          2m40s   nc
omgwtfssl                          0/1     ContainerCreating   0          2m39s   omgwtfssl
wordpress-76b5d9f5c8-xs44x         1/1     Running             4          39d     wordpress
wordpress-mysql-5548ff9655-85lcc   1/1     Running             1          39d     wordpress



▫️上記で表示されているpod情報を元に、yaml形式で出力を行ってみる。

# kubectl get pods -o yaml wordpress-76b5d9f5c8-xs44x 
================================================================
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2019-06-21T07:26:32Z"
  generateName: wordpress-76b5d9f5c8-
  labels:
    app: wordpress
    pod-template-hash: 76b5d9f5c8
    tier: frontend
  name: wordpress-76b5d9f5c8-xs44x
  namespace: default
  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: wordpress-76b5d9f5c8
    uid: e4ba6ac1-93f5-11e9-ab4f-b827eb29cf3e
  resourceVersion: "3431463"
  selfLink: /api/v1/namespaces/default/pods/wordpress-76b5d9f5c8-xs44x
  uid: e4d74853-93f5-11e9-ab4f-b827eb29cf3e
spec:
  containers:
  - env:
    - name: WORDPRESS_DB_HOST
      value: wordpress-mysql
    - name: WORDPRESS_DB_PASSWORD
      valueFrom:
        secretKeyRef:
          key: password
          name: mysql-pass
    image: wordpress:4.8-apache
    imagePullPolicy: IfNotPresent
    name: wordpress
    ports:
    - containerPort: 80
      name: wordpress
      protocol: TCP
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/www/html
      name: wordpress-persistent-storage
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: default-token-pqbtk
      readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: rasp-node2
  priority: 0
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - name: wordpress-persistent-storage
    persistentVolumeClaim:
      claimName: wp-pv-claim
  - name: default-token-pqbtk
    secret:
      defaultMode: 420
      secretName: default-token-pqbtk
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2019-06-21T07:26:33Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2019-07-19T04:08:53Z"
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2019-07-19T04:08:53Z"
    status: "True"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2019-06-21T07:26:33Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: docker://2a79538459b0721e2c901f8fcad74415655796568de48d8c0d06725becb0338e
    image: wordpress:4.8-apache
    imageID: docker-pullable://wordpress@sha256:6216f64ab88fc51d311e38c7f69ca3f9aaba621492b4f1fa93ddf63093768845
    lastState:
      terminated:
        containerID: docker://3ad2128df1a9bc70e4805635c4158bc64dd824e3d60353a94ecbcf396708025a
        exitCode: 1
        finishedAt: "2019-07-19T04:08:03Z"
        reason: Error
        startedAt: "2019-07-19T04:07:33Z"
    name: wordpress
    ready: true
    restartCount: 4
    state:
      running:
        startedAt: "2019-07-19T04:08:52Z"
  hostIP: 192.168.13.5
  phase: Running
  podIP: 10.244.2.29
  qosClass: BestEffort
  startTime: "2019-06-21T07:26:33Z"



0 件のコメント:

コメントを投稿

memo

  1)RDS に接続してみる 2)ドライバーを環境変数で定義してみる 以下、dockerfileに記載 ———————— # /bin/shを/bin/sh_tmpにリネーム > 同時に/bin/shに対して/bin/bashへのシンボリックリンクを作成 R...