Welcome to the Linux Foundation Forum!

Lab 5.1 unable to finish - kubernetes-admin no longer access to api ?

curl --cert client.pem --key client-key.pem --cacert ca.pem https://10.142.0.2:6443/api/v1/pods
work well.

But:

curl --cert client.pem --key client-key.pem --cacert ca.pem -XPOST -H 'Content-Type: application/json' -d@curlpod.json https://10.142.0.2:6443/api/v1/pods
give this output:

{
"kind": "Status",
"apiVersion": "v1",
"metadata": {

},
"status": "Failure",
"message": "the server does not allow this method on the requested resource",
"reason": "MethodNotAllowed",
"details": {

},
"code": 405

https://github.com/coredns/deployment/issues/3

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Posts: 4
    edited December 2018

    I was able to finish lab 5.1 just now, mostly as written. In my case, the one exception was that since I'm using minikube on Linux, I just directly used the cert/key files as shown below:

    1. $ curl --cert .minikube/client.crt --key .minikube/client.key --cacert .minikube/ca.crt https://192.168.99.100:8443/api/v1/namespaces/default/pods -XPOST -H'Content-Type: application/json' -d@curlpod.json
    2. {
    3. "kind": "Pod",
    4. "apiVersion": "v1",
    5. "metadata": {
    6. "name": "curlpod",
    7. "namespace": "default",
    8. "selfLink": "/api/v1/namespaces/default/pods/curlpod",
    9. "uid": "56353669-0c7e-11e9-8a4e-080027d81532",
    10. "resourceVersion": "19159",
    11. "creationTimestamp": "2018-12-30T22:00:36Z",
    12. "labels": {
    13. "name": "examplepod"
    14. }
    15. },
    16. "spec": {
    17. "volumes": [
    18. {
    19. "name": "default-token-wc2fg",
    20. "secret": {
    21. "secretName": "default-token-wc2fg",
    22. "defaultMode": 420
    23. }
    24. }
    25. ],
    26. "containers": [
    27. {
    28. "name": "nginx",
    29. "image": "nginx",
    30. "ports": [
    31. {
    32. "containerPort": 80,
    33. "protocol": "TCP"
    34. }
    35. ],
    36. "resources": {
    37.  
    38. },
    39. "volumeMounts": [
    40. {
    41. "name": "default-token-wc2fg",
    42. "readOnly": true,
    43. "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
    44. }
    45. ],
    46. "terminationMessagePath": "/dev/termination-log",
    47. "terminationMessagePolicy": "File",
    48. "imagePullPolicy": "Always"
    49. }
    50. ],
    51. "restartPolicy": "Always",
    52. "terminationGracePeriodSeconds": 30,
    53. "dnsPolicy": "ClusterFirst",
    54. "serviceAccountName": "default",
    55. "serviceAccount": "default",
    56. "securityContext": {
    57.  
    58. },
    59. "schedulerName": "default-scheduler",
    60. "tolerations": [
    61. {
    62. "key": "node.kubernetes.io/not-ready",
    63. "operator": "Exists",
    64. "effect": "NoExecute",
    65. "tolerationSeconds": 300
    66. },
    67. {
    68. "key": "node.kubernetes.io/unreachable",
    69. "operator": "Exists",
    70. "effect": "NoExecute",
    71. "tolerationSeconds": 300
    72. }
    73. ],
    74. "priority": 0
    75. },
    76. "status": {
    77. "phase": "Pending",
    78. "qosClass": "BestEffort"
    79. }
    80. }

    Here you can see that the pod was created:

    1. $ kubectl get pods
    2. NAME READY STATUS RESTARTS AGE
    3. curlpod 1/1 Running 0 2m51s
  • Hi @traq ,
    If step 7 worked ok for you, on step 9 did you attempt to curl to "https://10.142.0.2:6443/api/v1/namespaces/default/pods"?
    That's the URL used in step 9 in the Lab manual, and it is different than the URL from step 7.
    In step 7 you are just making an inquiry to the API server, to verify that you can connect via the ca, cert and key files.
    In step 9 you are creating a pod, and that resource will be created and saved under ".../api/v1/namespaces/default/pods" directory.
    Regards,
    -Chris

  • Posts: 2

    This:
    url --cert ./client.pem --key ./client-key.pem --cacert ./ca.pem -XPOST -H 'Content-Type: application/json' -d@curlpod.json https://10.142.0.2:6443/api/v1/namespaces/default/pods
    work well, and
    kubectl get pod
    NAME READY STATUS RESTARTS AGE
    busybox 0/1 Completed 0 3d22h
    curlpod 1/1 Running 0 3s

    So it's good be update Lab 5.1, because:
    curl --cert ./client.pem --key ./client-key.pem --cacert ./ca.pem -XPOST -H 'Content-Type: application/json' -d@curlpod.json https://10.142.0.2:6443/api/v1/pods
    not working any more

  • Posts: 2,434

    @traq
    That is the URL in Lab 5.1 step 9.
    If the URL from step 7 (.../api/v1/pods) is used with the curl command in step 9, it will not work. So in order to get a successful output in step 9, the URL has to be used as it is provided in the Lab 5.1 in step 9 (.../api/v1/namespaces/default/pods).
    -Chris

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training