mirror of
https://git.vectorsigma.ru/public/k3s.git
synced 2026-08-02 12:39:47 +00:00
Wait for apiserver to become healthy before starting agent controllers
It is possible that the apiserver may serve read requests but not allow writes yet, in which case flannel will crash on startup when trying to configure the subnet manager. Fix this by waiting for the apiserver to become fully ready before starting flannel and the network policy controller. Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
committed by
Brad Davidson
parent
9b39c1c117
commit
f970e49b7d
@@ -35,6 +35,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/controller-manager/app"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -98,6 +99,9 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
app.WaitForAPIServer(coreClient, 30*time.Second)
|
||||
|
||||
if !nodeConfig.NoFlannel {
|
||||
if err := flannel.Run(ctx, nodeConfig, coreClient.CoreV1().Nodes()); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user