<p>I'm new to kubernetes tool, i'm trying to deploy the Angular application using docker + kubernetes, here the below Jenkins script.</p>

<pre><code>stage('Deploy') {
       container('kubectl') {        
            withCredentials([kubeconfigFile(credentialsId: 'KUBERNETES_CLUSTER_CONFIG', variable: 'KUBECONFIG')]) {
            def kubectl
               kubectl = "kubectl --kubeconfig=${KUBECONFIG} --context=demo"
               echo 'deployment to PRERELEASE!'
               sh "kubectl config get-contexts"
               sh "kubectl -n demo get pods"
               sh  "${kubectl} apply -f ./environment/pre-release -n=pre-release"
               } 
            }
            }
    }
</code></pre>

<p>Please find the below jenkins outputs </p>

<pre><code>/home/jenkins/agent/workspace/DevOps-CI_future-master-fix
[Pipeline] stage
[Pipeline] { (Deploy)
[Pipeline] container
[Pipeline] {
[Pipeline] withCredentials
Masking supported pattern matches of $KUBECONFIG
[Pipeline] {
[Pipeline] echo
deploy to deployment!!
[Pipeline] echo
deploy to PRERELEASE!
[Pipeline] sh
+ kubectl config get-contexts
CURRENT   NAME                          CLUSTER      AUTHINFO           NAMESPACE
*         demo                          kubernetes   kubernetes-admin   demo
          kubernetes-admin@kubernetes   kubernetes   kubernetes-admin   
[Pipeline] sh
+ kubectl -n demo get pods
NAME                                                      READY   STATUS    RESTARTS   AGE
worker-f99adee3-dedd-46ca-bc0d-6b24391e5865-qkd47-mwl3v   5/5     Running   0          26s
[Pipeline] sh
+ kubectl '--kubeconfig=****' '--context=demo' apply -f ./environment/pre-release '-n=pre-release'
deployment.apps/frontend-deploy unchanged
service/frontend unchanged
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
Finished: SUCCESS

</code></pre>

<p>Now the questions is after the deployment i am not able to see the pods and deployment in both machine master machine using below command, can you please some one help me how to access the application after the successful deployment .</p>

<pre><code>kubectl get pods
kubectl get services
kubectl get deployments
</code></pre>

Anonymuss
<p>You are creating the resources in a namespace called <code>pre-release</code> using <code>-n</code> option when you run the following command. </p>

<pre><code>kubectl '--kubeconfig=****' '--context=demo' apply -f ./environment/pre-release '-n=pre-release'
deployment.apps/frontend-deploy unchanged
</code></pre>

<p>You need to to list the resources in the same namespace.</p>

<pre><code>kubectl get pods -n pre-release
kubectl get services -n pre-release
kubectl get deployments -n pre-release
</code></pre>

<p>By default <code>kubectl</code> will do the requested operation in <code>default</code> namespace. If you want to set your current namespace to <code>pre-release</code> so that you need not append <code>-n pre-release</code> with every kubectl command, you can run the following command:</p>

<pre><code>kubectl config set-context --current --namespace=pre-release
</code></pre>
