Как исправить Kubernetes Ingress Controller, отключая узлы от кластера

Запишите эту строку перед запросом HTTP запроса. это должно быть работой.

ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });


private static bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
        //Return true if the server certificate is ok
        if (sslPolicyErrors == SslPolicyErrors.None)
            return true;

        bool acceptCertificate = true;
        string msg = "The server could not be validated for the following reason(s):\r\n";

        //The server did not present a certificate
        if ((sslPolicyErrors &
             SslPolicyErrors.RemoteCertificateNotAvailable) == SslPolicyErrors.RemoteCertificateNotAvailable)
        {
            msg = msg + "\r\n    -The server did not present a certificate.\r\n";
            acceptCertificate = false;
        }
        else
        {
            //The certificate does not match the server name
            if ((sslPolicyErrors &
                 SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateNameMismatch)
            {
                msg = msg + "\r\n    -The certificate name does not match the authenticated name.\r\n";
                acceptCertificate = false;
            }

            //There is some other problem with the certificate
            if ((sslPolicyErrors &
                 SslPolicyErrors.RemoteCertificateChainErrors) == SslPolicyErrors.RemoteCertificateChainErrors)
            {
                foreach (X509ChainStatus item in chain.ChainStatus)
                {
                    if (item.Status != X509ChainStatusFlags.RevocationStatusUnknown &&
                        item.Status != X509ChainStatusFlags.OfflineRevocation)
                        break;

                    if (item.Status != X509ChainStatusFlags.NoError)
                    {
                        msg = msg + "\r\n    -" + item.StatusInformation;
                        acceptCertificate = false;
                    }
                }
            }
        }

        //If Validation failed, present message box
        if (acceptCertificate == false)
        {
            msg = msg + "\r\nDo you wish to override the security check?";
//          if (MessageBox.Show(msg, "Security Alert: Server could not be validated",
//                       MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                acceptCertificate = true;
        }

        return acceptCertificate;
    }
0
задан Nils Lamot 27 March 2019 в 08:32
поделиться

1 ответ

После долгого поиска мы наконец нашли рабочее решение для этой проблемы.

, Как упомянуто @A_Suh, пул дюйм/с, которого использует metallb, должен содержать дюйм/с, которые в настоящее время не используются одним из узлов в кластере. Путем добавления нового диапазона IP это также настроено в сервере DHCP, metallb может использовать ARP для соединения одного из дюйм/с к одному из узлов.

, Например, в моих 5 кластерах узла (kube11-15): Когда metallb получает диапазон 10.4.5.200/31 и выделяет 10.4.5.200 для моего nginx-ingress-controller, 10.4.5.200 связан с kube12. На запросах ARP на 10.4.5.200, все 5 узлов отвечают kube12, и трафик будет направлен к этому узлу.

0
ответ дан Nils Lamot 26 April 2019 в 09:39
поделиться
Другие вопросы по тегам:

Похожие вопросы: