Skip to content

Instantly share code, notes, and snippets.

@ivan4th
Created July 7, 2016 11:14
Show Gist options
  • Save ivan4th/ac9c1480c70672eaa87a66daff7d97e7 to your computer and use it in GitHub Desktop.
Save ivan4th/ac9c1480c70672eaa87a66daff7d97e7 to your computer and use it in GitHub Desktop.
kubectl apply int/ext mixup debugging on the client side
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ cat ~/work/ictest1.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
annotations:
pod.alpha.kubernetes.io/init-containers: "[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]"
spec:
containers:
- name: nginx
image: nginx:1.9.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
restartPolicy: Never
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ git diff
diff --git a/pkg/kubectl/apply.go b/pkg/kubectl/apply.go
index 6f183f1..799568a 100644
--- a/pkg/kubectl/apply.go
+++ b/pkg/kubectl/apply.go
@@ -19,6 +19,8 @@ package kubectl
import (
"encoding/json"
+ "github.com/davecgh/go-spew/spew"
+ "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api/annotations"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/kubectl/resource"
@@ -79,6 +81,9 @@ func SetOriginalConfiguration(info *resource.Info, original []byte) error {
// configuration. If an object was read from the command input, it will use that
// version of the object. Otherwise, it will use the version from the server.
func GetModifiedConfiguration(info *resource.Info, annotate bool, codec runtime.Encoder) ([]byte, error) {
+ glog.V(0).Infof("info.Object:\n%s\ninfo.VersionedObject:\n%s\n",
+ spew.Sdump(info.Object),
+ spew.Sdump(info.VersionedObject))
// First serialize the object without the annotation to prevent recursion,
// then add that serialization to it as the annotation and serialize it again.
var modified []byte
diff --git a/pkg/kubectl/cmd/apply.go b/pkg/kubectl/cmd/apply.go
index e198cfc..5a88e64 100644
--- a/pkg/kubectl/cmd/apply.go
+++ b/pkg/kubectl/cmd/apply.go
@@ -25,6 +25,8 @@ import (
"github.com/renstrom/dedent"
"github.com/spf13/cobra"
+ "github.com/davecgh/go-spew/spew"
+ "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
@@ -146,6 +148,9 @@ func RunApply(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *Ap
}
if err := info.Get(); err != nil {
+ glog.V(0).Infof("RunApply() after info.Get():\ninfo.Object:\n%s\ninfo.VersionedObject:\n%s\n",
+ spew.Sdump(info.Object),
+ spew.Sdump(info.VersionedObject))
if !errors.IsNotFound(err) {
return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%v\nfrom server for:", info), info.Source, err)
}
@@ -248,6 +253,8 @@ func (p *patcher) patchSimple(obj runtime.Object, modified []byte, source, names
return nil, cmdutil.AddSourceToErr(fmt.Sprintf("converting encoded server-side object back to versioned struct:\n%v\nfor:", obj), source, err)
}
+ glog.V(0).Infof("patchSimple:\ncurrent:\n%s\noriginal:\n%s\n\nmodified:\n%s\n\nversionedObject:\n%s\\nn",
+ current, original, modified, versionedObject)
// Compute a three way strategic merge patch to send to server.
patch, err := strategicpatch.CreateThreeWayMergePatch(original, modified, current, versionedObject, true)
if err != nil {
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ kc create -f ~/work/ictest1.yaml --save-config
proto: no encoder for TypeMeta unversioned.TypeMeta [GetProperties]
proto: tag has too few fields: "-"
proto: no coders for struct *reflect.rtype
proto: no encoder for sec int64 [GetProperties]
proto: no encoder for nsec int32 [GetProperties]
proto: no encoder for loc *time.Location [GetProperties]
proto: no encoder for Time time.Time [GetProperties]
proto: no encoder for i resource.int64Amount [GetProperties]
proto: no encoder for d resource.infDecAmount [GetProperties]
proto: no encoder for s string [GetProperties]
proto: no encoder for Format resource.Format [GetProperties]
proto: no encoder for InitContainers []v1.Container [GetProperties]
proto: no coders for intstr.Type
proto: no encoder for Type intstr.Type [GetProperties]
proto: no encoder for InitContainerStatuses []v1.ContainerStatus [GetProperties]
I0707 14:11:20.338616 26841 apply.go:86] info.Object:
(*api.Pod)(0xc820754000)(kind:"" apiVersion:"" )
info.VersionedObject:
(*v1.Pod)(0xc82036ab00)(TypeMeta:<kind:"Pod" apiVersion:"v1" > metadata:<name:"nginx" generateName:"" namespace:"" selfLink:"" uid:"" resourceVersion:"" generation:0 creationTimestamp:<0001-01-01T00:00:00Z> labels:<key:"app" value:"nginx" > annotations:<key:"pod.alpha.kubernetes.io/init-containers" value:"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]" > > spec:<containers:<name:"nginx" image:"nginx:1.9.1" workingDir:"" ports:<name:"" hostPort:0 containerPort:80 protocol:"" hostIP:"" > resources:<> terminationMessagePath:"" imagePullPolicy:"IfNotPresent" stdin:false stdinOnce:false tty:false > restartPolicy:"Never" dnsPolicy:"" serviceAccountName:"" serviceAccount:"" nodeName:"" hostNetwork:false hostPID:false hostIPC:false hostname:"" subdomain:"" > status:<phase:"" message:"" reason:"" hostIP:"" podIP:"" > )
pod "nginx" created
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ cluster/kubectl.sh apply -f ~/work/ictest1.yaml
proto: no encoder for TypeMeta unversioned.TypeMeta [GetProperties]
proto: tag has too few fields: "-"
proto: no coders for struct *reflect.rtype
proto: no encoder for sec int64 [GetProperties]
proto: no encoder for nsec int32 [GetProperties]
proto: no encoder for loc *time.Location [GetProperties]
proto: no encoder for Time time.Time [GetProperties]
proto: no encoder for i resource.int64Amount [GetProperties]
proto: no encoder for d resource.infDecAmount [GetProperties]
proto: no encoder for s string [GetProperties]
proto: no encoder for Format resource.Format [GetProperties]
proto: no encoder for InitContainers []v1.Container [GetProperties]
proto: no coders for intstr.Type
proto: no encoder for Type intstr.Type [GetProperties]
proto: no encoder for InitContainerStatuses []v1.ContainerStatus [GetProperties]
I0707 14:11:45.565878 27043 apply.go:86] info.Object:
(*api.Pod)(0xc8202ccc80)(kind:"" apiVersion:"" )
info.VersionedObject:
(*v1.Pod)(0xc820048b00)(TypeMeta:<kind:"Pod" apiVersion:"v1" > metadata:<name:"nginx" generateName:"" namespace:"" selfLink:"" uid:"" resourceVersion:"" generation:0 creationTimestamp:<0001-01-01T00:00:00Z> labels:<key:"app" value:"nginx" > annotations:<key:"pod.alpha.kubernetes.io/init-containers" value:"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]" > > spec:<containers:<name:"nginx" image:"nginx:1.9.1" workingDir:"" ports:<name:"" hostPort:0 containerPort:80 protocol:"" hostIP:"" > resources:<> terminationMessagePath:"" imagePullPolicy:"IfNotPresent" stdin:false stdinOnce:false tty:false > restartPolicy:"Never" dnsPolicy:"" serviceAccountName:"" serviceAccount:"" nodeName:"" hostNetwork:false hostPID:false hostIPC:false hostname:"" subdomain:"" > status:<phase:"" message:"" reason:"" hostIP:"" podIP:"" > )
I0707 14:11:45.569290 27043 apply.go:257] patchSimple:
current:
{"kind":"Pod","apiVersion":"v1","metadata":{"name":"nginx","namespace":"default","selfLink":"/api/v1/namespaces/default/pods/nginx","uid":"88609008-4433-11e6-a49e-60a44cac870b","resourceVersion":"326","creationTimestamp":"2016-07-07T11:11:20Z","labels":{"app":"nginx"},"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"nginx\",\"creationTimestamp\":null,\"labels\":{\"app\":\"nginx\"},\"annotations\":{\"pod.alpha.kubernetes.io/init-containers\":\"[{\\\"name\\\":\\\"wait\\\",\\\"image\\\":\\\"ubuntu:16.04\\\",\\\"command\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"sleep 10\\\"]}]\"}},\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginx:1.9.1\",\"ports\":[{\"containerPort\":80}],\"resources\":{},\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Never\"},\"status\":{}}","pod.alpha.kubernetes.io/init-container-statuses":"[{\"name\":\"wait\",\"state\":{\"terminated\":{\"exitCode\":0,\"reason\":\"Completed\",\"startedAt\":\"2016-07-07T11:11:22Z\",\"finishedAt\":\"2016-07-07T11:11:32Z\",\"containerID\":\"docker://cad4d674780df23f316bc290b73d0430b0ff7ff55500ed57593efca738477d4f\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"ubuntu:16.04\",\"imageID\":\"docker://sha256:12543ced0f6f754223eff4cca67b56cbf9f384456ab9deaa824ba9ff28bcfdd6\",\"containerID\":\"docker://cad4d674780df23f316bc290b73d0430b0ff7ff55500ed57593efca738477d4f\"}]","pod.alpha.kubernetes.io/init-containers":"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"],\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-ny13c\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"imagePullPolicy\":\"IfNotPresent\"}]"}},"spec":{"volumes":[{"name":"default-token-ny13c","secret":{"secretName":"default-token-ny13c"}}],"containers":[{"name":"nginx","image":"nginx:1.9.1","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"volumeMounts":[{"name":"default-token-ny13c","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","nodeName":"172.18.10.81","securityContext":{}},"status":{"phase":"Running","conditions":[{"type":"Initialized","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:11:32Z"},{"type":"Ready","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:11:33Z"},{"type":"PodScheduled","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:11:20Z"}],"hostIP":"172.18.10.81","podIP":"172.17.0.3","startTime":"2016-07-07T11:11:20Z","containerStatuses":[{"name":"nginx","state":{"running":{"startedAt":"2016-07-07T11:11:33Z"}},"lastState":{},"ready":true,"restartCount":0,"image":"nginx:1.9.1","imageID":"docker://sha256:94ec7e53edfc793d6d8412b4748cd84270da290ce9256730eb428574f98f7c95","containerID":"docker://9af14826fea41917815ec2aa8081e83d23f700520a6b0b5ba45d77b51f16cc3e"}]}}
original:
{"kind":"Pod","apiVersion":"v1","metadata":{"name":"nginx","creationTimestamp":null,"labels":{"app":"nginx"},"annotations":{"pod.alpha.kubernetes.io/init-containers":"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]"}},"spec":{"containers":[{"name":"nginx","image":"nginx:1.9.1","ports":[{"containerPort":80}],"resources":{},"imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Never"},"status":{}}
modified:
{"kind":"Pod","apiVersion":"v1","metadata":{"name":"nginx","creationTimestamp":null,"labels":{"app":"nginx"},"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"nginx\",\"creationTimestamp\":null,\"labels\":{\"app\":\"nginx\"},\"annotations\":{\"pod.alpha.kubernetes.io/init-containers\":\"[{\\\"name\\\":\\\"wait\\\",\\\"image\\\":\\\"ubuntu:16.04\\\",\\\"command\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"sleep 10\\\"]}]\"}},\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginx:1.9.1\",\"ports\":[{\"containerPort\":80}],\"resources\":{},\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Never\"},\"status\":{}}","pod.alpha.kubernetes.io/init-containers":"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]"}},"spec":{"containers":[{"name":"nginx","image":"nginx:1.9.1","ports":[{"containerPort":80}],"resources":{},"imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Never"},"status":{}}
versionedObject:
TypeMeta:<kind:"Pod" apiVersion:"v1" > metadata:<name:"nginx" generateName:"" namespace:"default" selfLink:"/api/v1/namespaces/default/pods/nginx" uid:"88609008-4433-11e6-a49e-60a44cac870b" resourceVersion:"326" generation:0 creationTimestamp:<2016-07-07T14:11:20+03:00> labels:<key:"app" value:"nginx" > annotations:<key:"kubectl.kubernetes.io/last-applied-configuration" value:"{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"nginx\",\"creationTimestamp\":null,\"labels\":{\"app\":\"nginx\"},\"annotations\":{\"pod.alpha.kubernetes.io/init-containers\":\"[{\\\"name\\\":\\\"wait\\\",\\\"image\\\":\\\"ubuntu:16.04\\\",\\\"command\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"sleep 10\\\"]}]\"}},\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginx:1.9.1\",\"ports\":[{\"containerPort\":80}],\"resources\":{},\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Never\"},\"status\":{}}" > annotations:<key:"pod.alpha.kubernetes.io/init-container-statuses" value:"[{\"name\":\"wait\",\"state\":{\"terminated\":{\"exitCode\":0,\"reason\":\"Completed\",\"startedAt\":\"2016-07-07T11:11:22Z\",\"finishedAt\":\"2016-07-07T11:11:32Z\",\"containerID\":\"docker://cad4d674780df23f316bc290b73d0430b0ff7ff55500ed57593efca738477d4f\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"ubuntu:16.04\",\"imageID\":\"docker://sha256:12543ced0f6f754223eff4cca67b56cbf9f384456ab9deaa824ba9ff28bcfdd6\",\"containerID\":\"docker://cad4d674780df23f316bc290b73d0430b0ff7ff55500ed57593efca738477d4f\"}]" > annotations:<key:"pod.alpha.kubernetes.io/init-containers" value:"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"],\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-ny13c\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"imagePullPolicy\":\"IfNotPresent\"}]" > > spec:<volumes:<name:"default-token-ny13c" volumeSource:<secret:<secretName:"default-token-ny13c" > > > containers:<name:"nginx" image:"nginx:1.9.1" workingDir:"" ports:<name:"" hostPort:0 containerPort:80 protocol:"TCP" hostIP:"" > resources:<> volumeMounts:<name:"default-token-ny13c" readOnly:true mountPath:"/var/run/secrets/kubernetes.io/serviceaccount" subPath:"" > terminationMessagePath:"/dev/termination-log" imagePullPolicy:"IfNotPresent" stdin:false stdinOnce:false tty:false > restartPolicy:"Never" terminationGracePeriodSeconds:30 dnsPolicy:"ClusterFirst" serviceAccountName:"default" serviceAccount:"default" nodeName:"172.18.10.81" hostNetwork:false hostPID:false hostIPC:false securityContext:<> hostname:"" subdomain:"" > status:<phase:"Running" conditions:<type:"Initialized" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:11:32+03:00> reason:"" message:"" > conditions:<type:"Ready" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:11:33+03:00> reason:"" message:"" > conditions:<type:"PodScheduled" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:11:20+03:00> reason:"" message:"" > message:"" reason:"" hostIP:"172.18.10.81" podIP:"172.17.0.3" startTime:<2016-07-07T14:11:20+03:00> containerStatuses:<name:"nginx" state:<running:<startedAt:<2016-07-07T14:11:33+03:00> > > lastState:<> ready:true restartCount:0 image:"nginx:1.9.1" imageID:"docker://sha256:94ec7e53edfc793d6d8412b4748cd84270da290ce9256730eb428574f98f7c95" containerID:"docker://9af14826fea41917815ec2aa8081e83d23f700520a6b0b5ba45d77b51f16cc3e" > > \nn
pod "nginx" configured
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ kc delete pod nginx
pod "nginx" deleted
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ kc create -f ~/work/ictest1.yaml
pod "nginx" created
ivan4th@ivan4th:~/work/kubernetes/src/k8s.io/kubernetes (fix-kubectl-apply-for-init-containers *%) $ cluster/kubectl.sh apply -f ~/work/ictest1.yaml
proto: no encoder for TypeMeta unversioned.TypeMeta [GetProperties]
proto: tag has too few fields: "-"
proto: no coders for struct *reflect.rtype
proto: no encoder for sec int64 [GetProperties]
proto: no encoder for nsec int32 [GetProperties]
proto: no encoder for loc *time.Location [GetProperties]
proto: no encoder for Time time.Time [GetProperties]
proto: no encoder for i resource.int64Amount [GetProperties]
proto: no encoder for d resource.infDecAmount [GetProperties]
proto: no encoder for s string [GetProperties]
proto: no encoder for Format resource.Format [GetProperties]
proto: no encoder for InitContainers []v1.Container [GetProperties]
proto: no coders for intstr.Type
proto: no encoder for Type intstr.Type [GetProperties]
proto: no encoder for InitContainerStatuses []v1.ContainerStatus [GetProperties]
I0707 14:12:26.020626 27419 apply.go:86] info.Object:
(*api.Pod)(0xc820624c80)(kind:"" apiVersion:"" )
info.VersionedObject:
(*v1.Pod)(0xc820412b00)(TypeMeta:<kind:"Pod" apiVersion:"v1" > metadata:<name:"nginx" generateName:"" namespace:"" selfLink:"" uid:"" resourceVersion:"" generation:0 creationTimestamp:<0001-01-01T00:00:00Z> labels:<key:"app" value:"nginx" > annotations:<key:"pod.alpha.kubernetes.io/init-containers" value:"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]" > > spec:<containers:<name:"nginx" image:"nginx:1.9.1" workingDir:"" ports:<name:"" hostPort:0 containerPort:80 protocol:"" hostIP:"" > resources:<> terminationMessagePath:"" imagePullPolicy:"IfNotPresent" stdin:false stdinOnce:false tty:false > restartPolicy:"Never" dnsPolicy:"" serviceAccountName:"" serviceAccount:"" nodeName:"" hostNetwork:false hostPID:false hostIPC:false hostname:"" subdomain:"" > status:<phase:"" message:"" reason:"" hostIP:"" podIP:"" > )
I0707 14:12:26.023819 27419 apply.go:257] patchSimple:
current:
{"kind":"Pod","apiVersion":"v1","metadata":{"name":"nginx","namespace":"default","selfLink":"/api/v1/namespaces/default/pods/nginx","uid":"a6f1f192-4433-11e6-a49e-60a44cac870b","resourceVersion":"349","creationTimestamp":"2016-07-07T11:12:11Z","labels":{"app":"nginx"},"annotations":{"pod.alpha.kubernetes.io/init-container-statuses":"[{\"name\":\"wait\",\"state\":{\"terminated\":{\"exitCode\":0,\"reason\":\"Completed\",\"startedAt\":\"2016-07-07T11:12:13Z\",\"finishedAt\":\"2016-07-07T11:12:23Z\",\"containerID\":\"docker://89e8a33086c1225d753542e82b93a76c5abfd0e4c8c93b5cf2900b3afded2f47\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"ubuntu:16.04\",\"imageID\":\"docker://sha256:12543ced0f6f754223eff4cca67b56cbf9f384456ab9deaa824ba9ff28bcfdd6\",\"containerID\":\"docker://89e8a33086c1225d753542e82b93a76c5abfd0e4c8c93b5cf2900b3afded2f47\"}]","pod.alpha.kubernetes.io/init-containers":"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"],\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-ny13c\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"imagePullPolicy\":\"IfNotPresent\"}]"}},"spec":{"volumes":[{"name":"default-token-ny13c","secret":{"secretName":"default-token-ny13c"}}],"containers":[{"name":"nginx","image":"nginx:1.9.1","ports":[{"containerPort":80,"protocol":"TCP"}],"resources":{},"volumeMounts":[{"name":"default-token-ny13c","readOnly":true,"mountPath":"/var/run/secrets/kubernetes.io/serviceaccount"}],"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Never","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","nodeName":"172.18.10.81","securityContext":{}},"status":{"phase":"Running","conditions":[{"type":"Initialized","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:12:24Z"},{"type":"Ready","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:12:25Z"},{"type":"PodScheduled","status":"True","lastProbeTime":null,"lastTransitionTime":"2016-07-07T11:12:11Z"}],"hostIP":"172.18.10.81","podIP":"172.17.0.3","startTime":"2016-07-07T11:12:11Z","containerStatuses":[{"name":"nginx","state":{"running":{"startedAt":"2016-07-07T11:12:24Z"}},"lastState":{},"ready":true,"restartCount":0,"image":"nginx:1.9.1","imageID":"docker://sha256:94ec7e53edfc793d6d8412b4748cd84270da290ce9256730eb428574f98f7c95","containerID":"docker://4a067c7e707d7e51abc15a282357bc7bcb6257936ec533515097f3ffae336f14"}]}}
original:
modified:
{"kind":"Pod","apiVersion":"v1","metadata":{"name":"nginx","creationTimestamp":null,"labels":{"app":"nginx"},"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"kind\":\"Pod\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"nginx\",\"creationTimestamp\":null,\"labels\":{\"app\":\"nginx\"},\"annotations\":{\"pod.alpha.kubernetes.io/init-containers\":\"[{\\\"name\\\":\\\"wait\\\",\\\"image\\\":\\\"ubuntu:16.04\\\",\\\"command\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"sleep 10\\\"]}]\"}},\"spec\":{\"containers\":[{\"name\":\"nginx\",\"image\":\"nginx:1.9.1\",\"ports\":[{\"containerPort\":80}],\"resources\":{},\"imagePullPolicy\":\"IfNotPresent\"}],\"restartPolicy\":\"Never\"},\"status\":{}}","pod.alpha.kubernetes.io/init-containers":"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"]}]"}},"spec":{"containers":[{"name":"nginx","image":"nginx:1.9.1","ports":[{"containerPort":80}],"resources":{},"imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Never"},"status":{}}
versionedObject:
TypeMeta:<kind:"Pod" apiVersion:"v1" > metadata:<name:"nginx" generateName:"" namespace:"default" selfLink:"/api/v1/namespaces/default/pods/nginx" uid:"a6f1f192-4433-11e6-a49e-60a44cac870b" resourceVersion:"349" generation:0 creationTimestamp:<2016-07-07T14:12:11+03:00> labels:<key:"app" value:"nginx" > annotations:<key:"pod.alpha.kubernetes.io/init-container-statuses" value:"[{\"name\":\"wait\",\"state\":{\"terminated\":{\"exitCode\":0,\"reason\":\"Completed\",\"startedAt\":\"2016-07-07T11:12:13Z\",\"finishedAt\":\"2016-07-07T11:12:23Z\",\"containerID\":\"docker://89e8a33086c1225d753542e82b93a76c5abfd0e4c8c93b5cf2900b3afded2f47\"}},\"lastState\":{},\"ready\":true,\"restartCount\":0,\"image\":\"ubuntu:16.04\",\"imageID\":\"docker://sha256:12543ced0f6f754223eff4cca67b56cbf9f384456ab9deaa824ba9ff28bcfdd6\",\"containerID\":\"docker://89e8a33086c1225d753542e82b93a76c5abfd0e4c8c93b5cf2900b3afded2f47\"}]" > annotations:<key:"pod.alpha.kubernetes.io/init-containers" value:"[{\"name\":\"wait\",\"image\":\"ubuntu:16.04\",\"command\":[\"/bin/sh\",\"-c\",\"sleep 10\"],\"resources\":{},\"volumeMounts\":[{\"name\":\"default-token-ny13c\",\"readOnly\":true,\"mountPath\":\"/var/run/secrets/kubernetes.io/serviceaccount\"}],\"terminationMessagePath\":\"/dev/termination-log\",\"imagePullPolicy\":\"IfNotPresent\"}]" > > spec:<volumes:<name:"default-token-ny13c" volumeSource:<secret:<secretName:"default-token-ny13c" > > > containers:<name:"nginx" image:"nginx:1.9.1" workingDir:"" ports:<name:"" hostPort:0 containerPort:80 protocol:"TCP" hostIP:"" > resources:<> volumeMounts:<name:"default-token-ny13c" readOnly:true mountPath:"/var/run/secrets/kubernetes.io/serviceaccount" subPath:"" > terminationMessagePath:"/dev/termination-log" imagePullPolicy:"IfNotPresent" stdin:false stdinOnce:false tty:false > restartPolicy:"Never" terminationGracePeriodSeconds:30 dnsPolicy:"ClusterFirst" serviceAccountName:"default" serviceAccount:"default" nodeName:"172.18.10.81" hostNetwork:false hostPID:false hostIPC:false securityContext:<> hostname:"" subdomain:"" > status:<phase:"Running" conditions:<type:"Initialized" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:12:24+03:00> reason:"" message:"" > conditions:<type:"Ready" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:12:25+03:00> reason:"" message:"" > conditions:<type:"PodScheduled" status:"True" lastProbeTime:<0001-01-01T00:00:00Z> lastTransitionTime:<2016-07-07T14:12:11+03:00> reason:"" message:"" > message:"" reason:"" hostIP:"172.18.10.81" podIP:"172.17.0.3" startTime:<2016-07-07T14:12:11+03:00> containerStatuses:<name:"nginx" state:<running:<startedAt:<2016-07-07T14:12:24+03:00> > > lastState:<> ready:true restartCount:0 image:"nginx:1.9.1" imageID:"docker://sha256:94ec7e53edfc793d6d8412b4748cd84270da290ce9256730eb428574f98f7c95" containerID:"docker://4a067c7e707d7e51abc15a282357bc7bcb6257936ec533515097f3ffae336f14" > > \nn
pod "nginx" configured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment