java icon indicating copy to clipboard operation
java copied to clipboard

deploy a pod from a Yaml file in kubeadm cluster

Open smaillns opened this issue 7 years ago • 5 comments

I get this error while trying to deploy a pod from yaml file using k8s client api

java.io.IOException: Unknown apiVersionKind: v1/Pod known kinds are: {} at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:490) ~[client-java-4.0.0.jar!/:na] at io.kubernetes.client.util.Yaml.load(Yaml.java:184) ~[client-java-4.0.0.jar!/:na] at io.kubernetes.client.util.Yaml.load(Yaml.java:172) ~[client-java-4.0.0.jar!/:na]

The problem occured while using kubeadm, but in minikube it works well !

public void deployPodFromFile(@PathVariable String name) throws IOException, ApiException{


        File file = new File("/~ path"+ name);


        //connect to the API Server
        ApiClient client = Config.defaultClient();
        Configuration.setDefaultApiClient(client);


        V1Pod pod = (V1Pod) Yaml.load(file);
        System.out.println(pod.toString());


        CoreV1Api api = new CoreV1Api();
        api.createNamespacedPod("default",pod,null, null, null);

smaillns avatar Aug 07 '19 10:08 smaillns

Your cluster is broken in some way (not sure what it is) or your not actually talking to the cluster.

Does kubectl work with the kubeadm cluster?

brendandburns avatar Aug 16 '19 20:08 brendandburns

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Nov 14 '19 20:11 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Dec 14 '19 21:12 fejta-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Jan 13 '20 22:01 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /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.

k8s-ci-robot avatar Jan 13 '20 22:01 k8s-ci-robot