我正在按照此文档在Kubernetes上设置Spinnaker.我按照指定运行脚本.然后启动复制控制器和服务.但有些POD没有启动
root@nveeru~# kubectl get pods --namespace=spinnaker
NAME READY STATUS RESTARTS AGE
data-redis-master-v000-zsn7e 1/1 Running 0 2h
spin-clouddriver-v000-6yr88 1/1 Running 0 47m
spin-deck-v000-as4v7 1/1 Running 0 2h
spin-echo-v000-g737r 1/1 Running 0 2h
spin-front50-v000-v1g6e 0/1 CrashLoopBackOff 21 2h
spin-gate-v000-9k401 0/1 Running 0 2h
spin-igor-v000-zfc02 1/1 Running 0 2h
spin-orca-v000-umxj1 0/1 CrashLoopBackOff 20 2h
Run Code Online (Sandbox Code Playgroud)
那我kubectl describe是豆荚
root@veeru:~# kubectl describe pod spin-orca-v000-umxj1 --namespace=spinnaker
Name: spin-orca-v000-umxj1
Namespace: spinnaker
Node: 172.25.30.21/172.25.30.21
Start Time: Mon, 19 Sep 2016 00:53:00 -0700
Labels: load-balancer-spin-orca=true,replication-controller=spin-orca-v000
Status: …Run Code Online (Sandbox Code Playgroud) 在循环中,Python如何确定哪些语句属于循环?
例如,在C中,可以写:
for(int i=0;i<=n;n++)
{ // start of block
Statment1
} // end of block
Statement2
Run Code Online (Sandbox Code Playgroud)
但是在下面的Python代码中
for i in range(5):
statement1
statement2
Run Code Online (Sandbox Code Playgroud)
我的意图是statement2走出困境.
Python将如何识别此块的结尾?通过使用TAB空间?
我很困惑会发生什么,特别是如果有嵌套循环.
我的项目树结构
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 example.gif\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 funmotd\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 config.json\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 quotes_db.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 LICENSE\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 README.md\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 setup.py\n\nRun Code Online (Sandbox Code Playgroud)\n\nsetup.py(为了减少代码量,删除了一些代码)
import sys\nimport os\nimport setuptools\nfrom setuptools.command.install import install\n\nclass PostInstall(install):\n def run(self):\n mode = 0o666\n bashrc_file = os.path.join(os.path.expanduser(\'~\'), ".bashrc")\n install.run(self)\n # Added CLI to .bashrc\n # Change "config.json" file permission\n\n\nsetuptools.setup(\n ...\n entry_points={\'console_scripts\': [\'funmotd = funmotd:main\']},\n package_dir={\'funmotd\': \'funmotd/\'},\n package_data={\'funmotd\': [\'config.json\'], },\n include_package_data=True,\n python_requires=">=3.4",\n cmdclass={\'install\': PostInstall, },\n ... \n)\n\nRun Code Online (Sandbox Code Playgroud)\n\nPostInstall当我运行时,执行得很好python3 setup.py install。因此,上传到Pypi如下(来自此文档)
$ python3 setup.py bdist_wheel\n# Created …Run Code Online (Sandbox Code Playgroud) 1.关注 - > https://kubernetes.io/docs/getting-started-guides/ubuntu/manual/
我按照他们在doc中提到的那样进行克隆.git clone --depth 1 https://github.com/kubernetes/kubernetes.git.我找不到cluster/ubuntu/config-default.sh配置群集的文件.
好的,我把它保留为默认值并尝试运行KUBERNETES_PROVIDER=ubuntu ./kube-up.sh但没有verify-kube-binaries.sh文件
root@ultron:/home/veeru# KUBERNETES_PROVIDER=ubuntu ./kube-up.sh
... Starting cluster using provider: ubuntu
... calling verify-prereqs
Skeleton Provider: verify-prereqs not implemented
... calling verify-kube-binaries
./kube-up.sh: line 44: verify-kube-binaries: command not found
Run Code Online (Sandbox Code Playgroud)
过时的文件?
2.从官方git repo,我已经下载了1.6.4版本(Branch- > Tag- > v1.6.4)cluster/ubuntu/config-default.sh配置后我KUBERNETES_PROVIDER=ubuntu ./kube-up.sh在cluster目录中运行.但是有些链接已经过时了!
3.最后,我试图Ubuntu 16用kubeadm.https://kubernetes.io/docs/getting-started-guides/kubeadm/
该kubeadm init命令成功完成没有任何问题,但是当我尝试时kubectl …
我使用的是Debian 7.4 Wheezy.我试图升级我的内核,但当我输入"make menuconfig"时它说:
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
Run Code Online (Sandbox Code Playgroud)
我试图安装"libncurses5-dev",但是我得到了错误:
E: Unable to locate package libncurses5-dev
Run Code Online (Sandbox Code Playgroud)
PS
我手动下载并安装了软件包,现在一切正常!非常感谢!!
K8版本:
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:44:27Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:33:17Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Run Code Online (Sandbox Code Playgroud)
我试图启动三角帆舱(此处为yaml文件)。我在安装K8时选择Flannel(kubectl apply -f kube-flannel.yml)。然后我看到豆荚没有开始,它被打成“ ContainerCreating”状态。我kubectl describe是一个豆荚,展示 NetworkPlugin cni failed to set up pod
veeru@ubuntu:/opt/spinnaker/experimental/kubernetes/simple$ kubectl describe pod data-redis-master-v000-38j80 --namespace=spinnaker
Name: data-redis-master-v000-38j80
Namespace: spinnaker
Node: ubuntu/192.168.6.136
Start Time: Thu, 01 Jun 2017 02:54:14 -0700
Labels: load-balancer-data-redis-server=true
replication-controller=data-redis-master-v000
Annotations: kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"spinnaker","name":"data-redis-master-v000","uid":"43d4a44c-46b0-11e7-b0e1-000c29b...
Status: Pending
IP:
Controllers: ReplicaSet/data-redis-master-v000
Containers:
redis-master:
Container ID:
Image: gcr.io/kubernetes-spinnaker/redis-cluster:v2 …Run Code Online (Sandbox Code Playgroud) Docker版本1.12,我Dockerfile从这里得到了一个
FROM nginx:latest
RUN touch /marker
ADD ./check_running.sh /check_running.sh
RUN chmod +x /check_running.sh
HEALTHCHECK --interval=5s --timeout=3s CMD ./check_running.sh
Run Code Online (Sandbox Code Playgroud)
我能够使用check_running.shshell脚本滚动更新和运行状况检查.这里,check_running.sh脚本被复制到image,因此启动的容器具有它.
现在,我的问题是从容器和脚本的外侧还有任何方法进行健康检查.
我除了使用运行状况检查命令来获取容器性能(取决于我们在脚本中写的内容),如果容器性能不好,它应该回滚到以前的版本(监视容器的进程类型,如果它不好,它应该回滚到以前)
谢谢
我想收集K8s中POD的指标。kube-state-metrics看起来不错。我无法按照README进行操作。我追了make container。有没有简单的方法来部署kube-state-metrics。
更新1
冉kubectl apply -f kubernetes。摆脱错误。我认为版本不匹配。任何想法如何克服?
serviceaccount "kube-state-metrics" configured
service "kube-state-metrics" configured
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-cluster-role-binding.yaml": ClusterRoleBinding in version "v1" cannot be handled as a ClusterRoleBinding: no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error when creating "kubernetes/kube-state-metrics-cluster-role.yaml": ClusterRole in version "v1" cannot be handled as a ClusterRole: no kind "ClusterRole" is registered for version "rbac.authorization.k8s.io/v1"
Error from server (BadRequest): error …Run Code Online (Sandbox Code Playgroud) 我只想 ping 主机(DNS 主机)来检查可达性。看起来没有正确的方法来做到这一点?我不知道。下面是我的剧本net_ping
---
- name: Set User
hosts: web_servers
gather_facts: false
become: false
vars:
ansible_network_os: linux
tasks:
- name: Pinging Host
net_ping
dest: 10.250.30.11
Run Code Online (Sandbox Code Playgroud)
但,
TASK [Pinging Host] *******************************************************************************************************************
task path: /home/veeru/PycharmProjects/Miscellaneous/tests/ping_test.yml:10
ok: [10.250.30.11] => {
"changed": false,
"msg": "Could not find implementation module net_ping for linux"
}
Run Code Online (Sandbox Code Playgroud)
带ping模块
---
- name: Set User
hosts: dns
gather_facts: false
become: false
tasks:
- name: Pinging Host
action: ping
Run Code Online (Sandbox Code Playgroud)
看起来它正在尝试 ssh 进入 IP。(在详细模式下检查)。我不知道为什么?如何进行 ICMP ping?我也不想将 DNS IP …
有人可以指导K8s自动发现的配置。Prometheus 服务器在集群之外。我尝试过使用 Kubernetes 进行服务发现,并且有人在此讨论中提到过
我还不是 K8s 专家,不足以解释这里的所有细节,但从根本上说,在集群之外运行 Prometheus 是完全可能的(并且需要冗余跨集群元监控等)。参见 http://prometheus.io/docs/operating/configuration/#kubernetes-sd-configurations-kubernetes_sd_config 中的
in_cluster配置选项 。如果你在外面运行它,你需要跳过证书圈。
所以,我做了一个简单的配置
- job_name: 'kubernetes'
kubernetes_sd_configs:
-
# The API server addresses. In a cluster this will normally be
# `https://kubernetes.default.svc`. Supports multiple HA API servers.
api_servers:
- https://xxx.xx.xx.xx
# Run in cluster. This will use the automounted CA certificate and bearer
# token file at /var/run/secrets/kubernetes.io/serviceaccount/ in the pod.
in_cluster: false
# Optional HTTP basic authentication information.
basic_auth:
username: prometheus
password: …Run Code Online (Sandbox Code Playgroud) 经理版Docker version 1.12.0-rc5, build a3f2063,
工人版Docker version 1.12.0-rc5, build a3f2063.
创建Swarm manger:
docker swarm init --advertise-addr "172.25.30.2:4243"
Swarm initialized: current node (3kmewyb10p8xj3ke5rpjyw4s8) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq \
172.25.30.2:4243
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-85cwe5pf779qw0knjn6wxdbim \
172.25.30.2:4243
Run Code Online (Sandbox Code Playgroud)
然后创造了工人
docker swarm join --token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq 172.25.30.2:4243
Error response from daemon: Timeout …Run Code Online (Sandbox Code Playgroud) 我明白
StatefulSet -管理/维护稳定的主机名,网络ID和永久存储。 HeadlessService -您需要为状态应用程序定义无头服务的稳定网络IDFROM K8s Docs->有时您不需要或不需要负载平衡和单个服务IP。在这种情况下,可以通过为群集IP(.spec.clusterIP)指定“无”来创建“无头”服务。
我对“有状态与无状态”应用程序/组件的看法
UI属于无状态应用程序/组件,因为它不维护任何数据。但是它来自数据库并显示
DB,Cache(Redis的)是有状态应用/组件,因为它具有保持数据的
我的问题。
Persistence storage in Apps-为什么要考虑将postgress(例如)部署为StatefulSet?我可以定义PVS和PVC在Deployement将数据存储在PV。即使Pod重新启动,它也会获得PV,因此不会丢失数据。
Network-Redis(例如)应该以部署StatefulSet,这样即使在重启Pod之后,我们也可以每次都获得唯一的“网络ID” /名称。例如; Redis-0,Redis-1是StatefulSet的,我可以定义Redis-0为主,所以主name永远不会改变。现在为什么要考虑Headless Service使用StatefulSet应用程序?我可以直接访问/连接POD本身,对吗?有什么用Headless Service?
我听说过Operators,这是管理StatefulSet应用程序的最佳方法。我在下面找到了一些例子。为什么这些(或其他一些)对于作为进行部署很重要StatefulSet。例如,Prometheus或ElasticSearch;我可以定义PVs和PVC存储数据而不会丢失。
为什么/何时应该关心StatefulSet和Headless Serivice?
我已经开始阅读 Elasticsearch 生命周期管理并尝试了解 ILM 的工作原理。我理解了一些术语,如下所示
滚动之前(假设已配置策略)
+--------------+
| |
| metricbeat | +----------------+
+------> (Aliase) +--->metricbeat7.1 |
| | | |
+--------------+ +----------------+
Run Code Online (Sandbox Code Playgroud)
翻转后,索引如下(取消当前索引的链接并指向新索引)
+--------------------+
| metricbeat7.1 |
| (read only) |
+--------------------+ +--------------------+
| |
| |
+----->+ meatricbeat | +---------------------+
| (Aliase) | | metricbeat-0001 |
| +-----> (write index) |
+--------------------+ +---------------------+
Run Code Online (Sandbox Code Playgroud)
我对展期概念的理解正确吗?在 kibana 的吹屏中,有一个选项“翻转时移至热阶段”意味着,metricbeat7.1在热阶段移动索引(来自上面的示例)?因为“发生了翻车”?正确的?
但是,如果我取消选择“滚动到热阶段”,索引仍然会进入热阶段怎么办?正确的?为什么我需要这个选项?
最后,什么是 …
kubernetes ×6
docker ×2
prometheus ×2
spinnaker ×2
ubuntu ×2
ansible ×1
debian ×1
ilm ×1
kernel ×1
linux ×1
ping ×1
pip ×1
pypi ×1
python ×1
python-3.x ×1
python-wheel ×1
redis ×1
setuptools ×1
statefulset ×1
upgrade ×1