如何在sidecar inject-config.yaml中更改istio全局参数

时间:2019-05-07 07:15:51

标签: kubernetes istio azure-kubernetes

我正在尝试在inject-config.yaml中更改istio全局配置参数initialDelaySeconds的值

initialDelaySeconds: [[ annotation .ObjectMeta `readiness.status.sidecar.istio.io/initialDelaySeconds`  1  ]]

当我尝试使用initialDelaySeconds的以下代码示例时,我遇到了错误。

$ kubectl get cm istio-sidecar-injector -n istio-system -o yaml | sed -e "s initialDelaySeconds: 1/ initialDelaySeconds: 10/" | kubectl apply -f -

遇到错误

 sed: -e expression #1, char 28: unknown option to `s'
 error: no objects passed to apply
 error: write /dev/stdout: The pipe has been ended.

更改sidecar inject-config.xml中的全局参数的正确语法是什么

下面的代码段也适用于rewriteAppHTTPProbe

$ kubectl get cm istio-sidecar-injector -n istio-system -o yaml | sed -e "s/ rewriteAppHTTPProbe: false/ rewriteAppHTTPProbe: true/" | kubectl apply -f -

3 个答案:

答案 0 :(得分:1)

如果可能,共享以下yaml文件 istio-sidecar-injector -n istio-system -o yaml

尝试

$email;$comment;$captcha;
        if(isset($_POST['email'])){
          $email=$_POST['email'];
        }
        if(isset($_POST['comment'])){
          $comment=$_POST['comment'];
        }
        if(isset($_POST['g-recaptcha-response'])){
          $captcha=$_POST['g-recaptcha-response'];
        }
        if(!$captcha){
          echo '<h2>Please check the the captcha form.</h2>';
          exit;
        }
        $secretKey = "6Ld-nnAUAAAAAHCq2ihUg006V8l0TFJBIlHi8VRD";
        $ip = $_SERVER['REMOTE_ADDR'];

        $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) .  '&response=' . urlencode($captcha);
        $response = file_get_contents($url);
        $responseKeys = json_decode($response,true);

        if($responseKeys["success"]) {
                echo '<h2>Thanks for posting comment</h2>';
        } else {
                echo '<h2>You are spammer ! Get the @$%K out</h2>';
        }

答案 1 :(得分:1)

常规kubectl edit cm仅适用于开源Istio。

否则,如果您将Istio用作GKE集群附件,则将有些棘手,因为所有编辑都通过在主节点上运行的Mixer进行协调。您可以做的就是转储configmap-> injection-cm,进行所需的编辑,然后将其用于手动注入,即

istioctl kube-inject -f deployment.yaml --injectConfigMapName injection-cm

更多信息here

答案 2 :(得分:1)

您可以只使用kubectl edit来编辑配置图:

kubectl edit cm istio-sidecar-injector -n istio-system