Kubernetes: can't delete namespace










0















I just created a namespace, have done nothing with it and now deleted it. However, when I list contexts I can still see it there. It seems to have been deleted as I can't delete it again. Why can I still see it listed when I get contexts?



kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* dev minikube minikube dev
minikube minikube minikube

kubectl delete namespace dev
namespace "dev" deleted

kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* dev minikube minikube dev
minikube minikube minikube


I switched contexts just in case but still get the same problem. E.g.



kubectl delete namespace dev
Error from server (NotFound): namespaces "dev" not found

kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
dev minikube minikube dev
* minikube minikube minikube


Interestingly, I don't see it when I list namespaces. E.g.



kubectl get namespaces









share|improve this question




























    0















    I just created a namespace, have done nothing with it and now deleted it. However, when I list contexts I can still see it there. It seems to have been deleted as I can't delete it again. Why can I still see it listed when I get contexts?



    kubectl config get-contexts
    CURRENT NAME CLUSTER AUTHINFO NAMESPACE
    * dev minikube minikube dev
    minikube minikube minikube

    kubectl delete namespace dev
    namespace "dev" deleted

    kubectl config get-contexts
    CURRENT NAME CLUSTER AUTHINFO NAMESPACE
    * dev minikube minikube dev
    minikube minikube minikube


    I switched contexts just in case but still get the same problem. E.g.



    kubectl delete namespace dev
    Error from server (NotFound): namespaces "dev" not found

    kubectl config get-contexts
    CURRENT NAME CLUSTER AUTHINFO NAMESPACE
    dev minikube minikube dev
    * minikube minikube minikube


    Interestingly, I don't see it when I list namespaces. E.g.



    kubectl get namespaces









    share|improve this question


























      0












      0








      0








      I just created a namespace, have done nothing with it and now deleted it. However, when I list contexts I can still see it there. It seems to have been deleted as I can't delete it again. Why can I still see it listed when I get contexts?



      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      * dev minikube minikube dev
      minikube minikube minikube

      kubectl delete namespace dev
      namespace "dev" deleted

      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      * dev minikube minikube dev
      minikube minikube minikube


      I switched contexts just in case but still get the same problem. E.g.



      kubectl delete namespace dev
      Error from server (NotFound): namespaces "dev" not found

      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      dev minikube minikube dev
      * minikube minikube minikube


      Interestingly, I don't see it when I list namespaces. E.g.



      kubectl get namespaces









      share|improve this question
















      I just created a namespace, have done nothing with it and now deleted it. However, when I list contexts I can still see it there. It seems to have been deleted as I can't delete it again. Why can I still see it listed when I get contexts?



      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      * dev minikube minikube dev
      minikube minikube minikube

      kubectl delete namespace dev
      namespace "dev" deleted

      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      * dev minikube minikube dev
      minikube minikube minikube


      I switched contexts just in case but still get the same problem. E.g.



      kubectl delete namespace dev
      Error from server (NotFound): namespaces "dev" not found

      kubectl config get-contexts
      CURRENT NAME CLUSTER AUTHINFO NAMESPACE
      dev minikube minikube dev
      * minikube minikube minikube


      Interestingly, I don't see it when I list namespaces. E.g.



      kubectl get namespaces






      kubernetes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 14:28







      Snowcrash

















      asked Nov 13 '18 at 14:21









      SnowcrashSnowcrash

      37.4k39134215




      37.4k39134215






















          1 Answer
          1






          active

          oldest

          votes


















          2














          A context in kubectlis just a local config that contains details (metadata) about a particular cluster or a namespace. This is the config that is needed for cluster/namespace management using the kubectl client.



          So, when you type kubectl config <any_command>, it's just doing a lookup in a file stored locally on you computer.
          Run the following to know more about this command and how to control the location of the config file:



          kubectl config --help


          Deleting a cluster or a namespace does not delete the associated context. The reason is that the deleting of a cluster or a namespace is an asynchronous operation that runs on the cluster. This operation may take longer than a few seconds to actually finish. Thus, kubectl cannot immediately delete the context from the config file after you issues the delete to the cluster master.



          To answer your question, you have to manually delete the context using:



          kubectl config delete-context dev





          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283120%2fkubernetes-cant-delete-namespace%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            A context in kubectlis just a local config that contains details (metadata) about a particular cluster or a namespace. This is the config that is needed for cluster/namespace management using the kubectl client.



            So, when you type kubectl config <any_command>, it's just doing a lookup in a file stored locally on you computer.
            Run the following to know more about this command and how to control the location of the config file:



            kubectl config --help


            Deleting a cluster or a namespace does not delete the associated context. The reason is that the deleting of a cluster or a namespace is an asynchronous operation that runs on the cluster. This operation may take longer than a few seconds to actually finish. Thus, kubectl cannot immediately delete the context from the config file after you issues the delete to the cluster master.



            To answer your question, you have to manually delete the context using:



            kubectl config delete-context dev





            share|improve this answer





























              2














              A context in kubectlis just a local config that contains details (metadata) about a particular cluster or a namespace. This is the config that is needed for cluster/namespace management using the kubectl client.



              So, when you type kubectl config <any_command>, it's just doing a lookup in a file stored locally on you computer.
              Run the following to know more about this command and how to control the location of the config file:



              kubectl config --help


              Deleting a cluster or a namespace does not delete the associated context. The reason is that the deleting of a cluster or a namespace is an asynchronous operation that runs on the cluster. This operation may take longer than a few seconds to actually finish. Thus, kubectl cannot immediately delete the context from the config file after you issues the delete to the cluster master.



              To answer your question, you have to manually delete the context using:



              kubectl config delete-context dev





              share|improve this answer



























                2












                2








                2







                A context in kubectlis just a local config that contains details (metadata) about a particular cluster or a namespace. This is the config that is needed for cluster/namespace management using the kubectl client.



                So, when you type kubectl config <any_command>, it's just doing a lookup in a file stored locally on you computer.
                Run the following to know more about this command and how to control the location of the config file:



                kubectl config --help


                Deleting a cluster or a namespace does not delete the associated context. The reason is that the deleting of a cluster or a namespace is an asynchronous operation that runs on the cluster. This operation may take longer than a few seconds to actually finish. Thus, kubectl cannot immediately delete the context from the config file after you issues the delete to the cluster master.



                To answer your question, you have to manually delete the context using:



                kubectl config delete-context dev





                share|improve this answer















                A context in kubectlis just a local config that contains details (metadata) about a particular cluster or a namespace. This is the config that is needed for cluster/namespace management using the kubectl client.



                So, when you type kubectl config <any_command>, it's just doing a lookup in a file stored locally on you computer.
                Run the following to know more about this command and how to control the location of the config file:



                kubectl config --help


                Deleting a cluster or a namespace does not delete the associated context. The reason is that the deleting of a cluster or a namespace is an asynchronous operation that runs on the cluster. This operation may take longer than a few seconds to actually finish. Thus, kubectl cannot immediately delete the context from the config file after you issues the delete to the cluster master.



                To answer your question, you have to manually delete the context using:



                kubectl config delete-context dev






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 13 '18 at 14:42

























                answered Nov 13 '18 at 14:30









                Ashu PachauriAshu Pachauri

                674611




                674611



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283120%2fkubernetes-cant-delete-namespace%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto