0

Editar Pod

Armando Serrano
Armando Serrano

Requerimientos:

  1. Tener un cluster de kubernetes .
  2. Tener corriendo un pod .
  3. Referencias :

Actividades:

  1. Listar pods con mas detalles
  2. Ver un pod en formato yaml
  3. Editar un pod

----------------------------------------------------------------------------------

Listar pods con mas detalles

[root@localhost ~]# kubectl get pods -o wide
NAME         READY   STATUS    RESTARTS   AGE     IP           NODE       NOMINATED NODE   READINESS GATES
simple-pod   2/2     Running   0          7m33s   172.17.0.3   minikube   <none>           <none>


Ver un pod en formato yaml

[root@localhost ~]# kubectl get pods -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Pod
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"app":"simple-pod"},"name":"simple-pod","namespace":"default"},"spec":{"containers":[{"command":["sleep","3600"],"image":"busybox","name":"simple-pod"},{"image":"nginx","name":"nginx"}]}}
    creationTimestamp: "2021-06-13T22:43:16Z"
    labels:
      app: simple-pod
    managedFields:
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubectl.kubernetes.io/last-applied-configuration: {}
          f:labels:
            .: {}
            f:app: {}
        f:spec:
          f:containers:
            k:{"name":"nginx"}:
              .: {}
              f:image: {}
              f:imagePullPolicy: {}
              f:name: {}
              f:resources: {}
              f:terminationMessagePath: {}
              f:terminationMessagePolicy: {}
            k:{"name":"simple-pod"}:
              .: {}
              f:command: {}
              f:image: {}
              f:imagePullPolicy: {}
              f:name: {}
              f:resources: {}
              f:terminationMessagePath: {}
              f:terminationMessagePolicy: {}
          f:dnsPolicy: {}
          f:enableServiceLinks: {}
          f:restartPolicy: {}
          f:schedulerName: {}
          f:securityContext: {}
          f:terminationGracePeriodSeconds: {}
      manager: kubectl
      operation: Update
      time: "2021-06-13T22:43:16Z"
    - apiVersion: v1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:conditions:
            k:{"type":"ContainersReady"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
            k:{"type":"Initialized"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
            k:{"type":"Ready"}:
              .: {}
              f:lastProbeTime: {}
              f:lastTransitionTime: {}
              f:status: {}
              f:type: {}
          f:containerStatuses: {}
          f:hostIP: {}
          f:phase: {}
          f:podIP: {}
          f:podIPs:
            .: {}
            k:{"ip":"172.17.0.3"}:
              .: {}
              f:ip: {}
          f:startTime: {}
      manager: kubelet
      operation: Update
      time: "2021-06-13T22:43:24Z"
    name: simple-pod
    namespace: default
    resourceVersion: "3430"
    uid: 72d6f092-cdbb-4875-bb54-fff2318d8f3b
  spec:
    containers:
    - command:
      - sleep
      - "3600"
      image: busybox
      imagePullPolicy: Always
      name: simple-pod
      resources: {}
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      volumeMounts:
      - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
        name: default-token-zrhrj
        readOnly: true
    - image: nginx
      imagePullPolicy: Always
      name: nginx
      resources: {}
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      volumeMounts:
      - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
        name: default-token-zrhrj
        readOnly: true
    dnsPolicy: ClusterFirst
    enableServiceLinks: true
    nodeName: minikube
    preemptionPolicy: PreemptLowerPriority
    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: default-token-zrhrj
      secret:
        defaultMode: 420
        secretName: default-token-zrhrj
  status:
    conditions:
    - lastProbeTime: null
      lastTransitionTime: "2021-06-13T22:43:16Z"
      status: "True"
      type: Initialized
    - lastProbeTime: null
      lastTransitionTime: "2021-06-13T22:43:24Z"
      status: "True"
      type: Ready
    - lastProbeTime: null
      lastTransitionTime: "2021-06-13T22:43:24Z"
      status: "True"
      type: ContainersReady
    - lastProbeTime: null
      lastTransitionTime: "2021-06-13T22:43:16Z"
      status: "True"
      type: PodScheduled
    containerStatuses:
    - containerID: docker://f35e694a58cc21a3c884ce2b3ae7d06d74d0c47fa944b7279ec45720f503039a
      image: nginx:latest
      imageID: docker-pullable://nginx@sha256:6d75c99af15565a301e48297fa2d121e15d80ad526f8369c526324f0f7ccb750
      lastState: {}
      name: nginx
      ready: true
      restartCount: 0
      started: true
      state:
        running:
          startedAt: "2021-06-13T22:43:22Z"
    - containerID: docker://d1b8fa4f4b5e9f3ec467d3c23c2b29fedf6986583c2d277c19cb15ccb028b0d2
      image: busybox:latest
      imageID: docker-pullable://busybox@sha256:930490f97e5b921535c153e0e7110d251134cc4b72bbb8133c6a5065cc68580d
      lastState: {}
      name: simple-pod
      ready: true
      restartCount: 0
      started: true
      state:
        running:
          startedAt: "2021-06-13T22:43:20Z"
    hostIP: 192.168.49.2
    phase: Running
    podIP: 172.17.0.3
    podIPs:
    - ip: 172.17.0.3
    qosClass: BestEffort
    startTime: "2021-06-13T22:43:16Z"
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

### en caso tener mas de un pod los listara todos ##

Editar un pod

[root@localhost ~]# kubectl edit pod simple-pod -n default

### esto le mostrara su pod en formato yaml en el editor "vi" podra modificar y salvar los cambios #### 






0
0

Comentários (0)