Merge pull request #412 from GLYASAI/unhealthy

[REV] add an unhealthy state
This commit is contained in:
barnettZQG 2019-09-01 07:21:52 -05:00 committed by GitHub
commit ff7144c82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1171 additions and 143 deletions

View File

@ -156,12 +156,12 @@ func recordUpdateEvent(clientset kubernetes.Interface, pod *corev1.Pod, f determ
return
}
podstatus := new(pb.PodStatus)
wutil.DescribePodStatus(pod, podstatus)
wutil.DescribePodStatus(clientset, pod, podstatus, k8sutil.DefListEventsByPod)
tenantID, serviceID, _, _ := k8sutil.ExtractLabels(pod.GetLabels())
// the pod in the pending status has no start time and container statuses
for _, cs := range pod.Status.ContainerStatuses {
state := cs.State
if podstatus.Type == pb.PodStatus_ABNORMAL || podstatus.Type == pb.PodStatus_NOTREADY { // TODO: not ready
if podstatus.Type == pb.PodStatus_ABNORMAL || podstatus.Type == pb.PodStatus_NOTREADY || podstatus.Type == pb.PodStatus_UNHEALTHY {
var eventID string
optType, message := f(clientset, pod, &state, k8sutil.DefListEventsByPod)
if optType == "" {

View File

@ -46,19 +46,21 @@ const (
PodStatus_INITIATING PodStatus_Type = 7
PodStatus_SCHEDULING PodStatus_Type = 8
PodStatus_NOTREADY PodStatus_Type = 9
PodStatus_UNHEALTHY PodStatus_Type = 10
)
var PodStatus_Type_name = map[int32]string{
0: "PENDING",
1: "RUNNING",
2: "SUCCEEDED",
3: "FAILED",
4: "UNKNOWN",
5: "TEMINATING",
6: "ABNORMAL",
7: "INITIATING",
8: "SCHEDULING",
9: "NOTREADY",
0: "PENDING",
1: "RUNNING",
2: "SUCCEEDED",
3: "FAILED",
4: "UNKNOWN",
5: "TEMINATING",
6: "ABNORMAL",
7: "INITIATING",
8: "SCHEDULING",
9: "NOTREADY",
10: "UNHEALTHY",
}
var PodStatus_Type_value = map[string]int32{
@ -72,6 +74,7 @@ var PodStatus_Type_value = map[string]int32{
"INITIATING": 7,
"SCHEDULING": 8,
"NOTREADY": 9,
"UNHEALTHY": 10,
}
func (x PodStatus_Type) String() string {
@ -1498,111 +1501,112 @@ func init() {
func init() { proto.RegisterFile("app_runtime_server.proto", fileDescriptor_f94cf1a886c479d6) }
var fileDescriptor_f94cf1a886c479d6 = []byte{
// 1655 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdb, 0x6e, 0x1b, 0x47,
0x12, 0x15, 0xef, 0x64, 0x51, 0xa4, 0xa8, 0xb6, 0x65, 0xd3, 0xb4, 0xbd, 0xb6, 0x67, 0x6d, 0x43,
0xc0, 0x1a, 0x5a, 0xaf, 0x76, 0x0d, 0xcb, 0x17, 0x78, 0x41, 0x93, 0x5c, 0x99, 0x58, 0x89, 0x12,
0x46, 0x14, 0x82, 0x3c, 0x11, 0x23, 0x4e, 0x5b, 0x99, 0x98, 0x9c, 0xe9, 0x4c, 0xcf, 0x28, 0xe0,
0x63, 0xf2, 0x0b, 0xc9, 0x7f, 0xe4, 0x3b, 0xf2, 0x92, 0xe4, 0x4f, 0xf2, 0x92, 0x0f, 0x08, 0xaa,
0xba, 0xe7, 0xc2, 0x8b, 0xe0, 0x28, 0x09, 0x90, 0xb7, 0xe9, 0xea, 0x73, 0xaa, 0xba, 0xaa, 0xbb,
0xab, 0xaa, 0x07, 0x9a, 0x96, 0x10, 0x23, 0x3f, 0x74, 0x03, 0x67, 0xca, 0x47, 0x92, 0xfb, 0x17,
0xdc, 0xdf, 0x11, 0xbe, 0x17, 0x78, 0x2c, 0x2b, 0xce, 0x8c, 0x12, 0x14, 0x7a, 0x53, 0x11, 0xcc,
0x8c, 0x7f, 0x42, 0xfd, 0x84, 0xfb, 0x17, 0xce, 0x98, 0x9b, 0xfc, 0x8b, 0x90, 0xcb, 0x80, 0xdd,
0x05, 0x90, 0x4a, 0x32, 0x72, 0xec, 0x66, 0xe6, 0x7e, 0x66, 0xbb, 0x62, 0x56, 0xb4, 0xa4, 0x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, 0x58, 0x3b, 0x2b, 0xd2, 0x6f, 0x9b, 0x7f, 0xff, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x8b,
0x8b, 0xd5, 0x60, 0xd2, 0x11, 0x00, 0x00,
// 1665 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x6e, 0x1b, 0x45,
0x14, 0x8e, 0xff, 0xed, 0xe3, 0xd8, 0x71, 0xa6, 0x4d, 0xeb, 0xba, 0x2d, 0x6d, 0x97, 0xb6, 0x8a,
0x44, 0x15, 0x4a, 0xa0, 0x6a, 0xfa, 0xa3, 0x22, 0xd7, 0x36, 0x89, 0x45, 0xe2, 0x44, 0x1b, 0x47,
0xa8, 0x57, 0xd6, 0xc6, 0x3b, 0x0d, 0x4b, 0xbd, 0xbb, 0xc3, 0xce, 0x6e, 0x90, 0x2f, 0xe1, 0x15,
0x78, 0x04, 0xde, 0x83, 0x7b, 0x6e, 0x80, 0x37, 0xe1, 0x86, 0x07, 0x40, 0x67, 0x7e, 0x76, 0xd7,
0x3f, 0x51, 0x09, 0x20, 0x71, 0xb7, 0x73, 0xe6, 0xfb, 0xce, 0x99, 0x73, 0x66, 0xe6, 0x9c, 0x33,
0x0b, 0x4d, 0x8b, 0xb1, 0x51, 0x10, 0x79, 0xa1, 0xe3, 0xd2, 0x11, 0xa7, 0xc1, 0x39, 0x0d, 0xb6,
0x58, 0xe0, 0x87, 0x3e, 0xc9, 0xb2, 0x53, 0xa3, 0x04, 0x85, 0x9e, 0xcb, 0xc2, 0xa9, 0xf1, 0x31,
0xd4, 0x8f, 0x69, 0x70, 0xee, 0x8c, 0xa9, 0x49, 0xbf, 0x8d, 0x28, 0x0f, 0xc9, 0x6d, 0x00, 0x2e,
0x25, 0x23, 0xc7, 0x6e, 0x66, 0xee, 0x66, 0x36, 0x2b, 0x66, 0x45, 0x49, 0xfa, 0xb6, 0xb1, 0x0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 0x55, 0x95, 0x96, 0xbe, 0x27, 0x52, 0x62, 0xac, 0x9c, 0x16, 0xc5,
0x5f, 0x9c, 0x4f, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x24, 0x27, 0xea, 0x25, 0xe1, 0x11, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -154,6 +154,7 @@ message PodStatus {
INITIATING = 7;
SCHEDULING = 8;
NOTREADY = 9;
UNHEALTHY = 10;
}
Type type = 1;

View File

@ -8,6 +8,7 @@ import (
"time"
"github.com/Sirupsen/logrus"
k8sutil "github.com/goodrain/rainbond/util/k8s"
"github.com/goodrain/rainbond/worker/server/pb"
"github.com/goodrain/rainbond/worker/util"
corev1 "k8s.io/api/core/v1"
@ -73,7 +74,7 @@ func (r *RuntimeServer) GetPodDetail(ctx context.Context, req *pb.GetPodDetailRe
}
describeContainers(pod.Spec.Containers, pod.Status.ContainerStatuses, &podDetail.Containers)
util.DescribePodStatus(pod, podDetail.Status)
util.DescribePodStatus(r.clientset, pod, podDetail.Status, k8sutil.DefListEventsByPod)
return podDetail, nil
}

View File

@ -31,6 +31,7 @@ import (
"github.com/goodrain/rainbond/db/model"
"github.com/goodrain/rainbond/discover.v2"
"github.com/goodrain/rainbond/util"
"github.com/goodrain/rainbond/util/k8s"
"github.com/goodrain/rainbond/worker/appm/store"
"github.com/goodrain/rainbond/worker/appm/thirdparty/discovery"
v1 "github.com/goodrain/rainbond/worker/appm/types/v1"
@ -161,7 +162,7 @@ func (r *RuntimeServer) GetAppPods(ctx context.Context, re *pb.ServiceRequest) (
Containers: containers,
}
podStatus := &pb.PodStatus{}
wutil.DescribePodStatus(pod, podStatus)
wutil.DescribePodStatus(r.clientset, pod, podStatus, k8s.DefListEventsByPod)
sapod.PodStatus = podStatus.Type.String()
if app.DistinguishPod(pod) {
newpods = append(newpods, sapod)

View File

@ -3,9 +3,12 @@ package util
import (
"fmt"
"sort"
"strings"
k8sutil "github.com/goodrain/rainbond/util/k8s"
"github.com/goodrain/rainbond/worker/server/pb"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
)
var podStatusTbl = map[string]pb.PodStatus_Type{
@ -20,7 +23,10 @@ var podStatusTbl = map[string]pb.PodStatus_Type{
}
// DescribePodStatus -
func DescribePodStatus(pod *corev1.Pod, podStatus *pb.PodStatus) {
func DescribePodStatus(clientset kubernetes.Interface, pod *corev1.Pod, podStatus *pb.PodStatus, f k8sutil.ListEventsByPod) {
defer func() {
podStatus.TypeStr = podStatus.Type.String()
}()
if pod.DeletionTimestamp != nil {
podStatus.Type = pb.PodStatus_TEMINATING
podStatus.Message = fmt.Sprintf("Termination Grace Period:\t%ds", *pod.DeletionGracePeriodSeconds)
@ -49,18 +55,32 @@ func DescribePodStatus(pod *corev1.Pod, podStatus *pb.PodStatus) {
for _, cstatus := range pod.Status.ContainerStatuses {
if !cstatus.Ready && cstatus.State.Terminated != nil {
podStatus.Type = pb.PodStatus_ABNORMAL
break
if cstatus.State.Terminated.Reason == "OOMKilled" {
podStatus.Advice = "Out of memory, it is recommended to allocate more memory to the program, check whether the program uses memory reasonably."
}
return
}
if !cstatus.Ready {
events := f(clientset, pod)
if events != nil {
for _, evt := range events.Items {
if strings.Contains(evt.Message, "Liveness probe failed") || strings.Contains(evt.Message, "Readiness probe failed") {
podStatus.Type = pb.PodStatus_UNHEALTHY
podStatus.Advice = "The health check failed, please check if the port of the program is available, and the health check configuration is correct."
return
}
}
}
}
if !cstatus.Ready && cstatus.State.Waiting != nil {
w := cstatus.State.Waiting
if w.Reason != "PodInitializing" && w.Reason != "ContainerCreating" {
podStatus.Type = pb.PodStatus_ABNORMAL
break
return
}
}
}
}
podStatus.TypeStr = podStatus.Type.String()
}
// SortableConditionType implements sort.Interface for []PodCondition based on

View File

@ -7,35 +7,62 @@ import (
"github.com/goodrain/rainbond/worker/server/pb"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
)
func eventsFromJSONFile(t *testing.T, filename string) *corev1.EventList {
jsonfile, err := ioutil.ReadFile(filename)
if err != nil {
t.Fatalf("failed to read file '%s': %v", filename, err)
}
var result corev1.EventList
if err := json.Unmarshal(jsonfile, &result); err != nil {
t.Fatalf("file: %s; failed to unmarshalling json: %v", filename, err)
}
return &result
}
func TestDescribePodStatus(t *testing.T) {
tests := []struct {
filename string
expstatus pb.PodStatus_Type
name, podfilename, eventsfilename string
expstatus pb.PodStatus_Type
}{
{filename: "testdata/insufficient-memory.json", expstatus: pb.PodStatus_SCHEDULING},
{filename: "testdata/containercreating.json", expstatus: pb.PodStatus_NOTREADY},
{filename: "testdata/crashloopbackoff.json", expstatus: pb.PodStatus_ABNORMAL},
{filename: "testdata/initiating.json", expstatus: pb.PodStatus_INITIATING},
{filename: "testdata/abnormal.json", expstatus: pb.PodStatus_ABNORMAL},
{name: "insufficient-memory", podfilename: "testdata/insufficient-memory.json", expstatus: pb.PodStatus_SCHEDULING},
{name: "containercreating", podfilename: "testdata/containercreating.json", expstatus: pb.PodStatus_NOTREADY},
{name: "crashloopbackoff", podfilename: "testdata/crashloopbackoff.json", expstatus: pb.PodStatus_ABNORMAL},
{name: "initiating", podfilename: "testdata/initiating.json", expstatus: pb.PodStatus_INITIATING},
{name: "notready", podfilename: "testdata/notready.json", expstatus: pb.PodStatus_NOTREADY},
{name: "liveness", podfilename: "testdata/liveness.json", eventsfilename: "testdata/livenessprobefailed.json", expstatus: pb.PodStatus_UNHEALTHY},
{name: "readiness", podfilename: "testdata/readiness.json", eventsfilename: "testdata/readinessprobefailed.json", expstatus: pb.PodStatus_UNHEALTHY},
}
for idx := range tests {
tc := tests[idx]
jsonfile, err := ioutil.ReadFile(tc.filename)
if err != nil {
t.Errorf("failed to read file '%s': %v", tc.filename, err)
}
t.Run(tc.name, func(t *testing.T) {
jsonfile, err := ioutil.ReadFile(tc.podfilename)
if err != nil {
t.Errorf("failed to read file '%s': %v", tc.podfilename, err)
}
var pod corev1.Pod
if err := json.Unmarshal(jsonfile, &pod); err != nil {
t.Fatalf("file: %s; failed to unmarshalling json: %v", tc.filename, err)
}
var pod corev1.Pod
if err := json.Unmarshal(jsonfile, &pod); err != nil {
t.Fatalf("file: %s; failed to unmarshalling json: %v", tc.podfilename, err)
}
podStatus := &pb.PodStatus{}
DescribePodStatus(&pod, podStatus)
if podStatus.Type != tc.expstatus {
t.Errorf("Expected %s for pod status type, but returned %s", tc.expstatus.String(), podStatus.Type.String())
}
listEventsByPodFunc := func(clientset kubernetes.Interface, pod *corev1.Pod) *corev1.EventList {
if tc.eventsfilename != "" {
events := eventsFromJSONFile(t, tc.eventsfilename)
return events
}
return nil
}
podStatus := &pb.PodStatus{}
DescribePodStatus(nil, &pod, podStatus, listEventsByPodFunc)
if podStatus.Type != tc.expstatus {
t.Errorf("Expected %s for pod status type, but returned %s", tc.expstatus.String(), podStatus.Type.String())
}
})
}
}

262
worker/util/testdata/liveness.json vendored Normal file
View File

@ -0,0 +1,262 @@
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"generateName": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/pods/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1447029",
"creationTimestamp": "2019-08-26T00:20:24Z",
"labels": {
"creater": "Rainbond",
"creater_id": "1566778824158858304",
"name": "gre7ff06",
"pod-template-hash": "1174582994",
"service_alias": "gre7ff06",
"service_id": "fa9c83c9198bfee9325804d3b4e7ff06",
"tenant_id": "f614a5eddea546c2bbaeb67d381599ee",
"tenant_name": "acx9dtbf",
"version": "20190826081937"
},
"annotations": {
"rainbond.com/tolerate-unready-endpoints": "true"
},
"ownerReferences": [
{
"apiVersion": "extensions/v1beta1",
"kind": "ReplicaSet",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8",
"uid": "4c1c6593-c797-11e9-a8e8-0800271b240e",
"controller": true,
"blockOwnerDeletion": true
}
]
},
"spec": {
"volumes": [
{
"name": "default-token-tmh2r",
"secret": {
"secretName": "default-token-tmh2r",
"defaultMode": 420
}
}
],
"containers": [
{
"name": "fa9c83c9198bfee9325804d3b4e7ff06",
"image": "goodrain.me/nginx:20190826081937",
"ports": [
{
"containerPort": 80,
"protocol": "TCP"
},
{
"containerPort": 88,
"protocol": "TCP"
}
],
"env": [
{
"name": "LOGGER_DRIVER_NAME",
"value": "streamlog"
},
{
"name": "PORT",
"value": "80"
},
{
"name": "PROTOCOL",
"value": "http"
},
{
"name": "MONITOR_PORT",
"value": "80:88"
},
{
"name": "CUR_NET",
"value": "midonet"
},
{
"name": "NGINX_VERSION",
"value": "1.17.3"
},
{
"name": "NJS_VERSION",
"value": "0.3.5"
},
{
"name": "PKG_RELEASE",
"value": "1~buster"
},
{
"name": "TENANT_ID",
"value": "f614a5eddea546c2bbaeb67d381599ee"
},
{
"name": "SERVICE_ID",
"value": "fa9c83c9198bfee9325804d3b4e7ff06"
},
{
"name": "MEMORY_SIZE",
"value": "small"
},
{
"name": "SERVICE_NAME",
"value": "gre7ff06"
},
{
"name": "SERVICE_EXTEND_METHOD",
"value": "stateless"
},
{
"name": "SERVICE_POD_NUM",
"value": "1"
},
{
"name": "HOST_IP",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "status.hostIP"
}
}
},
{
"name": "POD_IP",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "status.podIP"
}
}
}
],
"resources": {
"limits": {
"cpu": "0",
"memory": "64Mi"
},
"requests": {
"cpu": "0",
"memory": "64Mi"
}
},
"volumeMounts": [
{
"name": "default-token-tmh2r",
"readOnly": true,
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
}
],
"livenessProbe": {
"tcpSocket": {
"port": 88
},
"initialDelaySeconds": 2,
"timeoutSeconds": 30,
"periodSeconds": 3,
"successThreshold": 1,
"failureThreshold": 3
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "default",
"serviceAccount": "default",
"nodeName": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d",
"securityContext": {},
"affinity": {
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "beta.kubernetes.io/os",
"operator": "NotIn",
"values": [
"windows"
]
}
]
}
]
}
}
},
"schedulerName": "default-scheduler",
"tolerations": [
{
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
},
{
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
}
]
},
"status": {
"phase": "Running",
"conditions": [
{
"type": "Ready",
"status": "False",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-28T16:43:08Z",
"reason": "ContainersNotReady",
"message": "containers with unready status: [fa9c83c9198bfee9325804d3b4e7ff06]"
},
{
"type": "Initialized",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-26T00:20:24Z"
},
{
"type": "PodScheduled",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-26T00:20:24Z"
}
],
"hostIP": "192.168.199.218",
"podIP": "10.0.83.56",
"startTime": "2019-08-26T00:20:24Z",
"containerStatuses": [
{
"name": "fa9c83c9198bfee9325804d3b4e7ff06",
"state": {
"waiting": {
"reason": "CrashLoopBackOff",
"message": "Back-off 1m20s restarting failed container=fa9c83c9198bfee9325804d3b4e7ff06 pod=fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c_f614a5eddea546c2bbaeb67d381599ee(4c203ade-c797-11e9-a8e8-0800271b240e)"
}
},
"lastState": {
"terminated": {
"exitCode": 0,
"reason": "Completed",
"startedAt": "2019-08-28T16:43:02Z",
"finishedAt": "2019-08-28T16:43:07Z",
"containerID": "docker://4a89d758037595e055dbaf52cab0fc87234a2bd2b28a858877570dc3baae7a32"
}
},
"ready": false,
"restartCount": 1,
"image": "goodrain.me/nginx:20190826081937",
"imageID": ""
}
],
"qosClass": "Burstable"
}
}

View File

@ -0,0 +1,261 @@
{
"metadata": {
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events",
"resourceVersion": "1447029"
},
"items": [
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a2121cef0",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a2121cef0",
"uid": "4c2a0617-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436895",
"creationTimestamp": "2019-08-26T00:20:24Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436889"
},
"reason": "Scheduled",
"message": "Successfully assigned fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c to 959eba4b-6bbe-4ad5-ba0f-ecfad17d378d",
"source": {
"component": "default-scheduler"
},
"firstTimestamp": "2019-08-26T00:20:24Z",
"lastTimestamp": "2019-08-26T00:20:24Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a323f4c83",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a323f4c83",
"uid": "4c5433ed-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436915",
"creationTimestamp": "2019-08-26T00:20:24Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890"
},
"reason": "SuccessfulMountVolume",
"message": "MountVolume.SetUp succeeded for volume \"default-token-tmh2r\" ",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:24Z",
"lastTimestamp": "2019-08-26T00:20:24Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a5bc54e87",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a5bc54e87",
"uid": "4cbe64f3-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1446503",
"creationTimestamp": "2019-08-26T00:20:25Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "Pulled",
"message": "Container image \"goodrain.me/nginx:20190826081937\" already present on machine",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:25Z",
"lastTimestamp": "2019-08-28T16:42:04Z",
"count": 80,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a5ebf0f08",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a5ebf0f08",
"uid": "4cc7083b-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1437106",
"creationTimestamp": "2019-08-26T00:20:25Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "Created",
"message": "Created container",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:25Z",
"lastTimestamp": "2019-08-26T00:21:01Z",
"count": 4,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a6ae1d267",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510a6ae1d267",
"uid": "4ce4f8b1-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1437107",
"creationTimestamp": "2019-08-26T00:20:25Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "Started",
"message": "Started container",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:25Z",
"lastTimestamp": "2019-08-26T00:21:01Z",
"count": 4,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510b17eba2ec",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510b17eba2ec",
"uid": "4e9fea2b-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1441033",
"creationTimestamp": "2019-08-26T00:20:28Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "Unhealthy",
"message": "Liveness probe failed: dial tcp 10.0.83.56:88: getsockopt: connection refused",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:28Z",
"lastTimestamp": "2019-08-28T16:21:55Z",
"count": 74,
"type": "Warning",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510c9bde503b",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510c9bde503b",
"uid": "5281138b-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1437036",
"creationTimestamp": "2019-08-26T00:20:34Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "Killing",
"message": "Killing container with id docker://fa9c83c9198bfee9325804d3b4e7ff06:Container failed liveness probe.. Container will be killed and recreated.",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:34Z",
"lastTimestamp": "2019-08-26T00:20:46Z",
"count": 3,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510f68a0adc5",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c.15be510f68a0adc5",
"uid": "59ac4d16-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1437042",
"creationTimestamp": "2019-08-26T00:20:46Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "fa9c83c9198bfee9325804d3b4e7ff06-deployment-55c89d6ff8-mcv7c",
"uid": "4c203ade-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436890",
"fieldPath": "spec.containers{fa9c83c9198bfee9325804d3b4e7ff06}"
},
"reason": "BackOff",
"message": "Back-off restarting failed container",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:20:46Z",
"lastTimestamp": "2019-08-26T00:20:48Z",
"count": 2,
"type": "Warning",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
}
]
}

254
worker/util/testdata/readiness.json vendored Normal file
View File

@ -0,0 +1,254 @@
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"generateName": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/pods/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436560",
"creationTimestamp": "2019-08-26T00:19:22Z",
"labels": {
"creater": "Rainbond",
"creater_id": "1566778762689123048",
"name": "grd3ee94",
"pod-template-hash": "2694570412",
"service_alias": "grd3ee94",
"service_id": "0c3a85977aab7adcc8b3451472d3ee94",
"tenant_id": "f614a5eddea546c2bbaeb67d381599ee",
"tenant_name": "acx9dtbf",
"version": "20190826081817"
},
"annotations": {
"rainbond.com/tolerate-unready-endpoints": "true"
},
"ownerReferences": [
{
"apiVersion": "extensions/v1beta1",
"kind": "ReplicaSet",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856",
"uid": "276fd01b-c797-11e9-a8e8-0800271b240e",
"controller": true,
"blockOwnerDeletion": true
}
]
},
"spec": {
"volumes": [
{
"name": "default-token-tmh2r",
"secret": {
"secretName": "default-token-tmh2r",
"defaultMode": 420
}
}
],
"containers": [
{
"name": "0c3a85977aab7adcc8b3451472d3ee94",
"image": "goodrain.me/nginx:20190826081817",
"ports": [
{
"containerPort": 80,
"protocol": "TCP"
},
{
"containerPort": 88,
"protocol": "TCP"
}
],
"env": [
{
"name": "LOGGER_DRIVER_NAME",
"value": "streamlog"
},
{
"name": "PORT",
"value": "80"
},
{
"name": "PROTOCOL",
"value": "http"
},
{
"name": "MONITOR_PORT",
"value": "80:88"
},
{
"name": "CUR_NET",
"value": "midonet"
},
{
"name": "NGINX_VERSION",
"value": "1.17.3"
},
{
"name": "NJS_VERSION",
"value": "0.3.5"
},
{
"name": "PKG_RELEASE",
"value": "1~buster"
},
{
"name": "TENANT_ID",
"value": "f614a5eddea546c2bbaeb67d381599ee"
},
{
"name": "SERVICE_ID",
"value": "0c3a85977aab7adcc8b3451472d3ee94"
},
{
"name": "MEMORY_SIZE",
"value": "small"
},
{
"name": "SERVICE_NAME",
"value": "grd3ee94"
},
{
"name": "SERVICE_EXTEND_METHOD",
"value": "stateless"
},
{
"name": "SERVICE_POD_NUM",
"value": "1"
},
{
"name": "HOST_IP",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "status.hostIP"
}
}
},
{
"name": "POD_IP",
"valueFrom": {
"fieldRef": {
"apiVersion": "v1",
"fieldPath": "status.podIP"
}
}
}
],
"resources": {
"limits": {
"cpu": "0",
"memory": "64Mi"
},
"requests": {
"cpu": "0",
"memory": "64Mi"
}
},
"volumeMounts": [
{
"name": "default-token-tmh2r",
"readOnly": true,
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
}
],
"readinessProbe": {
"tcpSocket": {
"port": 88
},
"initialDelaySeconds": 2,
"timeoutSeconds": 30,
"periodSeconds": 3,
"successThreshold": 1,
"failureThreshold": 3
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "default",
"serviceAccount": "default",
"nodeName": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d",
"securityContext": {},
"affinity": {
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "beta.kubernetes.io/os",
"operator": "NotIn",
"values": [
"windows"
]
}
]
}
]
}
}
},
"schedulerName": "default-scheduler",
"tolerations": [
{
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
},
{
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
}
]
},
"status": {
"phase": "Running",
"conditions": [
{
"type": "Ready",
"status": "False",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-26T00:19:22Z",
"reason": "ContainersNotReady",
"message": "containers with unready status: [0c3a85977aab7adcc8b3451472d3ee94]"
},
{
"type": "Initialized",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-26T00:19:22Z"
},
{
"type": "PodScheduled",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-08-26T00:19:22Z"
}
],
"hostIP": "192.168.199.218",
"podIP": "10.0.83.54",
"startTime": "2019-08-26T00:19:22Z",
"containerStatuses": [
{
"name": "0c3a85977aab7adcc8b3451472d3ee94",
"state": {
"running": {
"startedAt": "2019-08-26T00:19:23Z"
}
},
"lastState": {},
"ready": false,
"restartCount": 0,
"image": "nginx:latest",
"imageID": "docker-pullable://nginx@sha256:53ddb41e46de3d63376579acf46f9a41a8d7de33645db47a486de9769201fec9",
"containerID": "docker://cfcf50b5dc02883c8ba31c00369240f4d1d341385eaffbe58b5277f7ee471147"
}
],
"qosClass": "Burstable"
}
}

View File

@ -0,0 +1,197 @@
{
"metadata": {
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events",
"resourceVersion": "1438552"
},
"items": [
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbcc1f749a",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbcc1f749a",
"uid": "2777d77c-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436541",
"creationTimestamp": "2019-08-26T00:19:22Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436534"
},
"reason": "Scheduled",
"message": "Successfully assigned 0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr to 959eba4b-6bbe-4ad5-ba0f-ecfad17d378d",
"source": {
"component": "default-scheduler"
},
"firstTimestamp": "2019-08-26T00:19:22Z",
"lastTimestamp": "2019-08-26T00:19:22Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbd65b58cc",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbd65b58cc",
"uid": "2791e94c-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436545",
"creationTimestamp": "2019-08-26T00:19:22Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436539"
},
"reason": "SuccessfulMountVolume",
"message": "MountVolume.SetUp succeeded for volume \"default-token-tmh2r\" ",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:19:22Z",
"lastTimestamp": "2019-08-26T00:19:22Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbffcda8dd",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fbffcda8dd",
"uid": "27fbd79a-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436552",
"creationTimestamp": "2019-08-26T00:19:23Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436539",
"fieldPath": "spec.containers{0c3a85977aab7adcc8b3451472d3ee94}"
},
"reason": "Pulled",
"message": "Container image \"goodrain.me/nginx:20190826081817\" already present on machine",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:19:23Z",
"lastTimestamp": "2019-08-26T00:19:23Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fc0350d09f",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fc0350d09f",
"uid": "2804c0d0-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436555",
"creationTimestamp": "2019-08-26T00:19:23Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436539",
"fieldPath": "spec.containers{0c3a85977aab7adcc8b3451472d3ee94}"
},
"reason": "Created",
"message": "Created container",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:19:23Z",
"lastTimestamp": "2019-08-26T00:19:23Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fc0f115672",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fc0f115672",
"uid": "2822ee49-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1436558",
"creationTimestamp": "2019-08-26T00:19:23Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436539",
"fieldPath": "spec.containers{0c3a85977aab7adcc8b3451472d3ee94}"
},
"reason": "Started",
"message": "Started container",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:19:23Z",
"lastTimestamp": "2019-08-26T00:19:23Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
},
{
"metadata": {
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fcbaed5811",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"selfLink": "/api/v1/namespaces/f614a5eddea546c2bbaeb67d381599ee/events/0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr.15be50fcbaed5811",
"uid": "29dacaca-c797-11e9-a8e8-0800271b240e",
"resourceVersion": "1438015",
"creationTimestamp": "2019-08-26T00:19:26Z"
},
"involvedObject": {
"kind": "Pod",
"namespace": "f614a5eddea546c2bbaeb67d381599ee",
"name": "0c3a85977aab7adcc8b3451472d3ee94-deployment-6bf89c4856-mm9mr",
"uid": "277222a7-c797-11e9-a8e8-0800271b240e",
"apiVersion": "v1",
"resourceVersion": "1436539",
"fieldPath": "spec.containers{0c3a85977aab7adcc8b3451472d3ee94}"
},
"reason": "Unhealthy",
"message": "Readiness probe failed: dial tcp 10.0.83.54:88: getsockopt: connection refused",
"source": {
"component": "kubelet",
"host": "959eba4b-6bbe-4ad5-ba0f-ecfad17d378d"
},
"firstTimestamp": "2019-08-26T00:19:26Z",
"lastTimestamp": "2019-08-26T00:24:23Z",
"count": 100,
"type": "Warning",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
}
]
}