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

Set correct powershell path for Windows #47

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Conversation

feiskyer
Copy link
Contributor

Fix #46

kubectl-node_shell Outdated Show resolved Hide resolved
@feiskyer
Copy link
Contributor Author

feiskyer commented Feb 1, 2023

@kvaps could you have a look again?

@feiskyer
Copy link
Contributor Author

feiskyer commented Feb 7, 2023

kindly ping @kvaps

@elitistphoenix
Copy link

elitistphoenix commented Aug 9, 2023

I'm not sure if they ever got back to you but it doesn't work for me on my 2019 EKS v1.27 optimised ami nodes

./kubectl-node_shell blah.compute.internal
spawning "pwsh-tc8oco" on "blah.compute.internal"
error: timed out waiting for the condition
pod "pwsh-tc8oco" deleted

@feiskyer
Copy link
Contributor Author

@elitistphoenix could you check what errors are happening in a different shell while running the node-shell command?

@elitistphoenix
Copy link

kubectl node-shell node.compute.internal
spawning "pwsh-7fdemk" on "node.compute.internal"
error: timed out waiting for the condition
pod "pwsh-7fdemk" deleted

same (obviously) for the -- echo 123 one too

@kvaps
Copy link
Owner

kvaps commented Aug 14, 2023

@feiskyer sorry for late reply, and thank you for your contribution.

The main problem is that ghcr.io/feiskyer/winservercore:v1.0 is not official image and I don't want to support it.
This plugin was designed to be very simple, stupid, however adding arch parser would definitely make it better. Thus if Microsoft is not bother building multiarch images, let's go this way then.

I wish to see something like:

os="$(kubectl get node -o jsonpath="{.metadata.labels.kubernetes\.io/os}-{.metadata.labels.kubernetes\.io/arch}" pve1 || exit 1)"

case $os in
  linux-*)
    image="${KUBECTL_NODE_SHELL_IMAGE:-docker.io/library/alpine}"
    name="nsenter"
  ;;
  windows-amd64)
    image="${KUBECTL_NODE_SHELL_IMAGE_WINDOWS_AMD64:-mcr.microsoft.com/powershell}"
    name="pwsh"
  ;;
  windows-arm64)
    image="${KUBECTL_NODE_SHELL_IMAGE_WINDOWS_ARM64:-mcr.microsoft.com/powershell}"
    name="pwsh"
  ;;
esac

@jkroepke
Copy link
Contributor

jkroepke commented Dec 2, 2023

Since a hostprocess container is spawned, what about https://github.com/microsoft/windows-host-process-containers-base-image ?

Then, the powershell from host can be used.

Switching Windows container image to
mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
so that all Windows container versions are supported.
@feiskyer
Copy link
Contributor Author

feiskyer commented Dec 7, 2023

Since a hostprocess container is spawned, what about https://github.com/microsoft/windows-host-process-containers-base-image ?

Thanks for the suggestions. Tried this new image and indeed working well on both 2022 and 2019. PR updated with this base image. PTAL

Copy link
Owner

@kvaps kvaps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@kvaps kvaps merged commit 92d4cac into kvaps:master Jan 18, 2024
@feiskyer feiskyer deleted the fix-win branch January 18, 2024 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubectl-node-shell 1.7.0 does not support Windows2019
5 participants