小编Vee*_*dra的帖子

Kubernetes上的三角帆:无法在kubernetes中启动大三角帆容器

我正在按照此文档在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)

kubernetes spinnaker

19
推荐指数
1
解决办法
1834
查看次数

Python如何知道代码块是在循环中?

在循环中,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空间?

我很困惑会发生什么,特别是如果有嵌套循环.

python

12
推荐指数
1
解决办法
5450
查看次数

使用 pip 执行安装后任务

我的项目树结构

\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\n
Run Code Online (Sandbox Code Playgroud)\n\n

setup.py(为了减少代码量,删除了一些代码)

\n\n
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\n
Run Code Online (Sandbox Code Playgroud)\n\n

PostInstall当我运行时,执行得很好python3 setup.py install。因此,上传到Pypi如下(来自此文档

\n\n
$ python3 setup.py bdist_wheel\n# Created …
Run Code Online (Sandbox Code Playgroud)

pip setuptools pypi python-3.x python-wheel

9
推荐指数
1
解决办法
1770
查看次数

如何在Ubuntu 14中安装最新的生产级Kubernetes

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.shcluster目录中运行.但是有些链接已经过时了!

错误

3.最后,我试图Ubuntu 16kubeadm.https://kubernetes.io/docs/getting-started-guides/kubeadm/

kubeadm init命令成功完成没有任何问题,但是当我尝试时kubectl …

ubuntu kubernetes

8
推荐指数
1
解决办法
4606
查看次数

无法进行menuconfig

我使用的是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

我手动下载并安装了软件包,现在一切正常!非常感谢!!

linux ubuntu debian kernel upgrade

7
推荐指数
1
解决办法
3万
查看次数

豆荚没有开始。NetworkPlugin CNI无法设置Pod

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时选择Flannelkubectl 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)

kubernetes spinnaker

7
推荐指数
2
解决办法
1万
查看次数

docker(1.12)容器的运行状况检查命令(不在Dockerfile中!)

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,因此启动的容器具有它.

现在,我的问题是从容器和脚本的外侧还有任何方法进行健康检查.

我除了使用运行状况检查命令来获取容器性能(取决于我们在脚本中写的内容),如果容器性能不好,它应该回滚到以前的版本(监视容器的进程类型,如果它不好,它应该回滚到以前)

谢谢

health-monitoring docker

6
推荐指数
1
解决办法
7132
查看次数

如何安装kube-state-metrics

我想收集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)

kubernetes prometheus

6
推荐指数
1
解决办法
6966
查看次数

在 ansible playbook 中 Ping 主机

我只想 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 …

ping ansible

6
推荐指数
2
解决办法
4万
查看次数

Prometheus 自动发现 K8s

有人可以指导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)

kubernetes prometheus

5
推荐指数
1
解决办法
3685
查看次数

Docker1.12工作者无法加入群集(Swarm:Pending)

经理版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)

docker

2
推荐指数
1
解决办法
1万
查看次数

有状态和无头服务如何工作-K8s

我明白

  • StatefulSet -管理/维护稳定的主机名,网络ID和永久存储。
  • HeadlessService -您需要为状态应用程序定义无头服务的稳定网络ID

FROM K8s Docs->有时您不需要或不需要负载平衡和单个服务IP。在这种情况下,可以通过为群集IP(.spec.clusterIP)指定“无”来创建“无头”服务。

我对“有状态与无状态”应用程序/组件的看法

  1. UI属于无状态应用程序/组件,因为它不维护任何数据。但是它来自数据库并显示

  2. DBCache(Redis的)是有状态应用/组件,因为它具有保持数据的

我的问题。

  1. Persistence storage in Apps-为什么要考虑将postgress(例如)部署为StatefulSet?我可以定义PVS和PVCDeployement将数据存储在PV。即使Pod重新启动,它也会获得PV,因此不会丢失数据。

  2. Network-Redis(例如)应该以部署StatefulSet,这样即使在重启Pod之后,我们也可以每次都获得唯一的“网络ID” /名称。例如; Redis-0Redis-1StatefulSet的,我可以定义Redis-0为主,所以主name永远不会改变。现在为什么要考虑Headless Service使用StatefulSet应用程序?我可以直接访问/连接POD本身,对吗?有什么用Headless Service

  3. 我听说过Operators,这是管理StatefulSet应用程序的最佳方法。我在下面找到了一些例子。为什么这些(或其他一些)对于作为进行部署很重要StatefulSet。例如,PrometheusElasticSearch;我可以定义PVsPVC存储数据而不会丢失。

为什么/何时应该关心StatefulSetHeadless Serivice

redis kubernetes statefulset kubernetes-service

2
推荐指数
1
解决办法
2268
查看次数

Elasticsearch ILM 术语和概念

我已经开始阅读 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在热阶段移动索引(来自上面的示例)?因为“发生了翻车”?正确的?

但是,如果我取消选择“滚动到热阶段”,索引仍然会进入热阶段怎么办?正确的?为什么我需要这个选项?

在此输入图像描述

最后,什么是 …

elasticsearch ilm index-management

2
推荐指数
1
解决办法
473
查看次数