小编tim*_*mss的帖子

Kubernetes:Linux docker-multinode集群中的特权容器

(我已经看了一些其他线程,但显然现在最新的代码支持特权模式,所以我想知道我是否遇到了一个bug.)

我有两个物理服务器:都运行Linux(ubuntu),昨天使用github的最新kubernetes代码.

我正在跑步docs/getting-started-guides/docker-multinode/master.sh(&worker.sh).

在主节点上:

$ kubectl create -f examples/nfs/nfs-server-rc.yaml
The ReplicationController "nfs-server" is invalid. 
spec.template.spec.containers[0].securityContext.privileged: forbidden '<*>(0xc208389770)true'
Run Code Online (Sandbox Code Playgroud)

问题:这是否受到支持?或者我做错了什么.或者这是一个错误,拜托?

master.sh代码已经提供了选项--allow-privileged=true.

设置了以下这些选项,但并没有很好的信念,只是因为我在其他地方看到了一些讨论设置它们.

/etc/default/kubelet: 
    `KUBELET_OPTS="--allow_privileged=true"`

/etc/default/kube-apiserver: 
    `KUBE_APISERVER_OPTS="--allow_privileged=true"`
Run Code Online (Sandbox Code Playgroud)

主配置:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"2+", GitVersion:"v1.2.0-alpha.5.833+2e5da8b881e2f5", GitCommit:"2e5da8b881e2f5b6dfb66653acf4aaa1ca1f398e", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"1", GitVersion:"v1.1.3", GitCommit:"6a81b50c7e97bbe0ade075de55ab4fa34f049dc2", GitTreeState:"clean"}

$ docker version
Client:
Version:      1.9.1
API version:  1.21
Go version:   go1.4.2
Git commit:   a34a1d5
Built:        Fri Nov 20 13:12:04 UTC 2015
OS/Arch:      linux/amd64
Server:
Version:      1.9.1
API version:  1.21
Go …
Run Code Online (Sandbox Code Playgroud)

ubuntu containers kubernetes

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

如何在文本文件中找到最长的单词?

我创建了一个函数来查找文本文件中最长的单词,并在文本文件中找到可以由9个字母组成的最长单词.我是python的新手,我正在创建一个类似于倒计时的游戏.

我创建了一个函数来查找文本文件中最长的单词.我现在想要的是创建python代码以找到可以由9个字母组成的最长单词.

每个字母只能使用一次.因此,从'qugteroda',我应该得到rag outou,愤怒,out out,out read,outout,readout.我正在使用python 3.3

我的代码看起来像这样:

def Words():
    qfile=open('dict.txt','r')
    long=''
    for line in qfile:
    if len(line)>len(long):
        long=line
    return long
Run Code Online (Sandbox Code Playgroud)

python python-3.x python-3.3

0
推荐指数
1
解决办法
5766
查看次数

在Python 2.7中,我怎样才能将't'替换为'top'而将'h'替换为'hop'仅当'th'不可见时

我是新来的,也是python,但我想尝试一下!我想在一个句子中将't'替换为'top'而'h'替换为'hop',只有当'th'不可见时才会因为'th'将成为'thop'.例如:'Thi hi tea'必须成为'thopi hopi topea'.我有这个代码:

sentence = str(raw_input('give me a sentence '))

start = 0
out = ''
while True:
    i = string.find( sentence, 'th', start )
    if i == -1:
        sentence = sentence.replace('t', 'top')
        sentence = sentence.replace('h', 'hop')
        break
    out = out + sentence[start:i] + 'thop'
    start = i+2
Run Code Online (Sandbox Code Playgroud)

但是没有用......有什么想法吗?

python regex replace

0
推荐指数
1
解决办法
111
查看次数

如何回到特定的行

print "1) Add"
print "2) Substract"
print "3) Multiply"
print "4) Divide"
print "5) Exit"

x=input("Choose an operation: ")
y=input("How many numbers do you need to operate: ")
op=1
lista=[]

while y>0:
    a=input("Value"+" "+str(op)+": ")
    litlist=[a]
    lista=lista+litlist
    y=y-1
    op=op+1

while x!=5:
    if x==1:
        b=0
        for n in lista:
            b=b+n
        print b
    elif x==2:
        b=0
        for n in lista:
            if lista[0]==n:
                b=b+n
            else:
                b=b-n
        print b
    elif x==3:
        b=1
        for n in lista:
            b=b*n
        print b
    elif x==4:
        b=1
        for n …
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
2387
查看次数

如何在另一个函数内部调用多次返回变量的函数?

我有一个函数(基于文本的游戏),它在整个过程中多次请求输入,在进行错误检查之前,我想要立即删除所有空格.

为了减少冗余,我想做另外两个函数,然后像这样返回变量:

def startGame():
    print("1, 2 or 3?")
    response = response()

def response():
    a = raw_input()
    a = a.strip()
    return a

startGame()
Run Code Online (Sandbox Code Playgroud)

问题是我不断得到:

UnboundLocalError:赋值前引用的局部变量'response'.

这对我没有意义,因为响应被赋予了response()返回值.
我错过了什么?有更简单的方法吗?

python user-input return function

0
推荐指数
1
解决办法
151
查看次数

插入单个字符重新映射

我有一个系统在vim中插入单个字符 - 我使用:nmap <Space> i_<Esc>r.然而,出于某种原因,这似乎干扰了我重新逃脱.我重新开始逃跑了:imap kj <Esc>.

每当我按下时kj,vim会_在我的光标前插入一个,然后改变我按下空格的样子.我无法弄清楚为什么这些东西会像这样互动.有人可以解释一下这个问题吗?我很感激.

这是我的整个vimrc

"general settings
syntax on
filetype plugin on
set number
set smd
set ru

"Leader
let mapleader=','
nmap <Leader>w :w<Enter>
nmap <leader>e :wq<Enter>
nmap <leader>q :q!<Enter>

"remappings
nmap ; :
imap kj <Esc>
nmap <Space> i_<Esc>r

"au comands
au Filetype python source ~/.vim/scripts/python.vim
au Filetype ruby source ~/.vim/scripts/ruby.vim
au Filetype c source ~/.vim/scripts/c.vim
Run Code Online (Sandbox Code Playgroud)

vim command-line remap

0
推荐指数
1
解决办法
237
查看次数

Eclipse中的死代码警告 - 这是Eclipse中的一个错误吗?还是我忽略了明显的东西?

使用这个(简化的)代码示例Eclipse(Kepler SR2)为最内层的if语句(if (con != null)),死代码发出警告.

public class DbManager {
    public String getSingleString(String query) throws SQLException {
        DbManager dbmgr = new DbManager();
        Connection con = null;
        try {
            con = dbmgr.getConnection("user", "pwd", URL);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
            if (con != null) {
                PreparedStatement pstmt = null;
                ResultSet rset = null;
                pstmt = con.prepareStatement(query.toString());
                rset = pstmt.executeQuery();
            if (rset != null && rset.next()) {
                return (rset.getString(1));
            }
        }
    }
return …
Run Code Online (Sandbox Code Playgroud)

java eclipse dead-code compiler-warnings suppress-warnings

0
推荐指数
1
解决办法
205
查看次数