Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Prepare-AntreaAgent.ps1 fails for containerized ovs #5852

Closed
antoninbas opened this issue Jan 8, 2024 · 5 comments · Fixed by #5859
Closed

[Windows] Prepare-AntreaAgent.ps1 fails for containerized ovs #5852

antoninbas opened this issue Jan 8, 2024 · 5 comments · Fixed by #5859
Assignees
Labels
area/OS/windows Issues or PRs related to the Windows operating system. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@antoninbas
Copy link
Contributor

antoninbas commented Jan 8, 2024

Describe the bug
I am trying to add a Windows Node to a K8s cluster using the "containerized OVS" installation method for Antrea.
When trying to run Prepare-AntreaAgent.ps1, I get the following error:

PS C:\k\antrea> .\Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false
Cleaning stale Antrea network resources if they exist...
[SC] CreateService SUCCESS
[SC] ChangeServiceConfig2 SUCCESS
Start-Service : Service 'ovsdb-server (ovsdb-server)' cannot be started due to the following error: Cannot start service ovsdb-server on computer '.'.
At C:\k\antrea\Clean-AntreaNetwork.ps1:80 char:5
+     Start-Service ovsdb-server
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

The error is generated by Clean-AntreaNetwork.ps1, which is invoked by Prepare-AntreaAgent.ps1.

We can see that the script tries to create an OVS service, which doesn't make sense for the containerized OVS case.

The following questions come to mind:

  1. When running Prepare-AntreaAgent.ps1 with -RunOVSServices $false, should Clean-AntreaNetwork.ps1 be invoked with -OVSRunMode "container"?
  2. When running Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false, it seems that Prepare-AntreaAgent.ps1 doesn't actually do anything besides calling Clean-AntreaNetwork.ps1. Is that accurate? I just want to check that my understanding is correct.

Versions:
Antrea v1.14 and top-of-tree

@antoninbas antoninbas added area/OS/windows Issues or PRs related to the Windows operating system. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jan 8, 2024
@antoninbas antoninbas added this to the Antrea v1.15 release milestone Jan 8, 2024
@antoninbas
Copy link
Contributor Author

@Atish-iaf
Copy link
Contributor

Atish-iaf commented Jan 9, 2024

Hi @antoninbas

When running Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false, it seems that Prepare-AntreaAgent.ps1 doesn't actually do anything besides calling Clean-AntreaNetwork.ps1. Is that accurate? I just want to check that my understanding is correct.

Yes, and i think in case of containerized ovs instead of
.\Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false
we can use

# If OVS userspace processes were running inside container in antrea-agent Pod
./Clean-AntreaNetwork.ps1 -OVSRunMode "container"

https://github.com/antrea-io/antrea/blob/main/docs/windows.md#:~:text=%23%20If%20OVS%20userspace%20processes%20were%20running%20inside%20container%20in%20antrea%2Dagent%20Pod%0A./Clean%2DAntreaNetwork.ps1%20%2DOVSRunMode%20%22container%22
always, because incase of containerized OVS, -RunOVSServices will always be false and -InstallKubeProxy will also be false as -InstallKubeProxy is true for k8s version prior to 1.26 but ovs containerization uses windows host process as true which was GA in k8s 1.26.

@antoninbas
Copy link
Contributor Author

In any case, it would make sense to fix .\Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false. Even if Clean-AntreaNetwork.ps1 can be run directly, we would just make the documentation more complicated by calling this out.

@antoninbas
Copy link
Contributor Author

If it's just about invoking Clean-AntreaNetwork.ps1 with the correct OVSRunMode flag, I can take care of it. I'll just need folks to review the PR and tell me if I'm missing something.

@antoninbas antoninbas self-assigned this Jan 9, 2024
antoninbas added a commit to antoninbas/antrea that referenced this issue Jan 9, 2024
In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes antrea-io#5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
@rajnkamr
Copy link
Contributor

2. When running Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false, it seems that Prepare-AntreaAgent.ps1 doesn't actually do anything besides calling Clean-AntreaNetwork.ps1. Is that accurate? I just want to check that my understanding is correct.

@antoninbas
In Ovs containerization case,
"Prepare-AntreaAgent.ps1 -InstallKubeProxy $false -RunOVSServices $false" will only be used for calling Clean-AntreaNetwork.ps1 to clean antrea-hns network / Remove stale network resources created by antrea-agent after the Windows Node reboots and will not start ovs services.

I also think it is better to still use Prepare-AntreaAgent.ps1 and invoke Clean-AntreaNetwork.ps1 with right parameters in ovs containerization case.

antoninbas added a commit to antoninbas/antrea that referenced this issue Jan 10, 2024
In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes antrea-io#5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit that referenced this issue Jan 11, 2024
)

In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes #5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit to antoninbas/antrea that referenced this issue Jan 11, 2024
In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes antrea-io#5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit to antoninbas/antrea that referenced this issue Jan 11, 2024
In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes antrea-io#5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit that referenced this issue Jan 11, 2024
)

In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes #5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit that referenced this issue Jan 11, 2024
)

In "containerized OVS" mode, Clean-AntreaNetwork.ps1 should be invoked
with `-OVSRunMode "container"`.

Fixes #5852

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/OS/windows Issues or PRs related to the Windows operating system. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants