Google容器引擎 - 更新复制控制器多容器窗格

时间:2016-02-29 13:18:50

标签: google-cloud-platform kubernetes google-kubernetes-engine

尝试使用

更新多容器窗格
<?php
    if( $_SERVER['REQUEST_METHOD']=='POST' ){

        if ( !empty( $_POST['search_term'] ) ) { 

            $dbhost =   'localhost';
            $dbuser =   'root'; 
            $dbpwd  =   'xxx'; 
            $dbname =   'xxx';

            $db =   new mysqli( $dbhost, $dbuser, $dbpwd, $dbname );

            /* using lower() helped account for vagueries in spelling */
            $sql='select * from `maps` where 
                    lower( `location_name` ) like lower( "%'.$_POST['search_term'].'%" );';

            $res=$db->query( $sql );
            if( $res ){
                while( $rs=$res->fetch_object() ){
                    echo "<li>".$rs->location_name."</li>";
                }
            }
        }
        exit();
    }
?>
<!doctype html>
<html lang='en'>
  <head>
    <title>Gotta have a title!</title>
    <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'></script>
    <script type='text/javascript'>
        $( document ).ready( function() {
            $('.searchFunction').keyup( function( event ) {

                var search_term=this.value;

                /* maybe better to search after a few letters have been added? */
               if( search_term.length < 5 )return;

                /* it appears you are posting to the same page */
                $.post( document.location.href, { search_term:search_term }, function( data ) {
                    $('.result').html( data );

                    $('.result li').click( function( event ) {
                        var result_value = $(this).text();

                        $('.searchFunction').attr( 'value', result_value );
                        $('.result').html('');
                    });
                });
            });
        });
    </script>
  </head>
  <body>
    <div class='container'>
        <input type='text' name='search_term' class='searchFunction'>
        <input type='submit' value='Search'>
        <div class='dropdown'>
            <ul class='result'></ul>
        </div>
    </div>
  </body>
</html>

我得到了:

kubectl rolling-update my_rc --image=eu.gcr.io/project_id/myimage

更新单个容器的方法是什么,或者我必须删除并重新创建pod?

1 个答案:

答案 0 :(得分:0)

目前,您最好的选择是更新定义复制控制器的yaml文件以使用新映像并运行:

kubectl rolling-update my_rc -f my_file.yaml

如果您没有定义复制控制器的yaml文件,可以通过运行以下命令获取:

kubectl get rc my_rc --output=yaml > my_file.yaml

然后,您应该能够更新该文件中指定的图像并运行滚动更新。

在Kubernetes的下一个版本(针对3月份)中,您将能够通过--container标志告诉kubectl pod中的哪些容器应该使用新图像:

kubectl rolling-update my_rc --container=my_container --image=eu.gcr.io/project_id/myimage

版本1.1被删除后,此功能为added by a community member