python
python copied to clipboard
create_namespaced_custom_object returns 404
What happened (please include outputs or screenshots):
I tried to use create_namespaced_custom_object but i'm getting HTTP response body: 404 page not found
I use k3d locally.
How to reproduce it (as minimally and precisely as possible):
def applyyamlfile(yamlfile,namespace):
config.load_kube_config()
k8s_api = client.CustomObjectsApi()
group = 'split.smi-spec.io'
version = 'v1alpha1'
namespace = namespace
plural = 'TrafficSplit'
body=yaml.safe_load(yamlfile)
api_response = k8s_api.create_namespaced_custom_object(group, version, namespace, plural, body)
yamlfile = "apiVersion: split.smi-spec.io/v1alpha1
kind: TrafficSplit
metadata:
name: traffic-split-v3
namespace: default
spec:
service: productcatalogservice
backends:
- service: productcatalogservice-first
weight: 900m
- service: productcatalogservice
weight: 100m"
namespace = 'default'
Environment:
- Kubernetes version (
kubectl version
): v1.22.4 - OS (e.g., MacOS 10.13.6): Ubuntu 20.04
- Python version (
python --version
) 3.8.10 (i also tried 3.6.15) - Python client version (
pip list | grep kubernetes
) 21.0.0-snapshot
/assign
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
I too have this issue. Any fix I can try?
@cham-d
def applyyamlfile(yamlfile,namespace): config.load_kube_config() k8s_api = client.CustomObjectsApi() group = 'split.smi-spec.io' version = 'v1alpha1' namespace = namespace plural = 'TrafficSplit' body=yaml.safe_load(yamlfile) api_response = k8s_api.create_namespaced_custom_object(group, version, namespace, plural, body)
I think plural = 'trafficsplits'
should fix the issue. You need to pass the plural name ('trafficsplits'), not kind ('TrafficSplit').
https://github.com/servicemeshinterface/smi-sdk-go/blob/main/crds/split.yaml#L14
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Reopen this issue or PR with
/reopen
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
@k8s-triage-robot: Closing this issue.
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied- After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied- After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closedYou can:
- Reopen this issue or PR with
/reopen
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
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.