-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
"Upgrade request required" when posting port forward #585
Comments
Anyone ever make progress on this or get port-forward to work from within the python client? |
I am facing this issue. Any steps to get this working? |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
This should be tracked to #166 |
@micw523: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This still seems to be a relevant issue even after the release of 12.0.0. Was any progress made here? |
I am also facing this issue. Could it be possible to get some guidance? |
I don't think that this client.CoreV1Api().connect_post_namespaced_pod_portforward('pod-name', 'namespace-name') is intended to be used directly. In examples, you wrap it to get a raw socket. Or you can use the |
I managed to get this working by waiting for the Pod until it reports from kubernetes import client, utils, watch
from kubernetes.client.rest import logger
from kubernetes.stream import portforward
import time
k8s_objects = utils.create_from_yaml(
k8s_client=self._kubernetes_client,
yaml_file=filename,
verbose=True
)
w = watch.Watch()
core_v1 = self._kubernetes_core_v1_client
start_time = time.time()
for event in w.stream(
func=core_v1.list_namespaced_pod,
namespace=k8s_objects[0][0].metadata.namespace,
label_selector="env=integration,tier=backend",
timeout_seconds=60):
if event["object"].status.phase == "Running":
w.stop()
end_time = time.time()
logger.info("%s started in %0.2f sec", k8s_objects[0][0].metadata.name, end_time - start_time)
pf = portforward(
self._kubernetes_core_v1_client.connect_get_namespaced_pod_portforward,
name="myapp",
namespace="default",
ports=8080
)
self._tcp = pf.socket(8080)
self._tcp.setblocking(True)
logger.info("Port %s exposed. You can reach it on localhost.", pf.local_ports[8080].port_number)
return
if event["type"] == "DELETED":
logger.debug("%s deleted before it started", k8s_objects[0][0].metadata.name)
w.stop()
return
You'll need apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: watch-permission
rules:
- apiGroups:
- ""
resources:
- pods
- pods/portforward
verbs:
- watch |
When attempting to post a port forward to a pod, for example:
An error is thrown:
This happens regardless of whether the additional param of 'ports' is passed to the API call.
Environment:
The text was updated successfully, but these errors were encountered: