我最近一直在试验kubernetes,我一直在尝试通过一个复制控制器测试pod中的故障转移,其中容器一旦使用就会崩溃(从而导致重启).
我已经为此调整了bashttpd项目:https: //github.com/Chronojam/bashttpd
(我在哪里设置它以便它提供容器的主机名,然后退出)
这很好用,除了重启对于我要做的事情来说要慢得多,因为它适用于前几个请求,然后停止一段时间 - 然后在重新启动pod时再次开始工作.(理想情况下,id在访问服务时看不到任何中断).
我认为(但不确定)这里提到的备份延迟应该归咎于:https: //github.com/kubernetes/kubernetes/blob/master/docs/user-guide/pod-states.md#restartpolicy
一些输出:
#] kubectl get pods
NAME READY STATUS RESTARTS AGE
chronojam-blog-a23ak 1/1 Running 0 6h
chronojam-blog-abhh7 1/1 Running 0 6h
chronojam-serve-once-1cwmb 1/1 Running 7 4h
chronojam-serve-once-46jck 1/1 Running 7 4h
chronojam-serve-once-j8uyc 1/1 Running 3 4h
chronojam-serve-once-r8pi4 1/1 Running 7 4h
chronojam-serve-once-xhbkd 1/1 Running 4 4h
chronojam-serve-once-yb9hc 1/1 Running 7 4h
chronojam-tactics-is1go 1/1 Running 0 5h
chronojam-tactics-tqm8c 1/1 Running 0 5h
#] curl http://serve-once.chronojam.co.uk
<h3> chronojam-serve-once-j8uyc </h3>
#] …Run Code Online (Sandbox Code Playgroud) 我一直在尝试为我的仪表板创建一个自定义小部件,它使用django-dashing框架运行
https://github.com/talpor/django-dashing
http://django-dashing.readthedocs.org/en/latest/
我的CustomWidget定义如下:
CustomWidget.py:
from dashing.widgets import Widget
class CustomWidget(Widget):
title = ''
more_info = ''
updated_at = ''
detail = ''
value = ''
def get_title(self):
return self.title
def get_more_info(self):
return self.more_info
def get_updated_at(self):
return self.updated_at
def get_detail(self):
return self.detail
def get_value(self):
return "$67"
#return self.value
def get_context(self):
return {
'title': self.get_title(),
'more_info': self.get_more_info(),
'updated_at': self.get_updated_at(),
'detail': self.get_detail(),
'value': self.get_value(),
}
Run Code Online (Sandbox Code Playgroud)
静态/部件/ custom_widget/custom_widget.css:
.widget-custom_widget {
background-color: #96bf48;
}
.widget-custom_widget h1 {
color: rgba(255, 255, 255, 0.7);
}
.widget-custom_widget …Run Code Online (Sandbox Code Playgroud)