Answers for "how to know namespace is present or not in kubernetes shell script"

1

how to know namespace is present or not in kubernetes shell script

#!/bin/bash

namespaceStatus=$(kubectl get ns nightlybuild-test -o json | jq .status.phase -r)
if [ $namespaceStatus == "Active" ]
then
    echo "namespace is present"
else
   echo "namespace is not present"
Posted by: Guest on July-23-2021
0

kubernetes check current namespace

# Create NS
kubectl create namespace my-namespace
# Select NS
kubectl config set-context --current --namespace=my-namespace
# Check current NS
kubectl config view | grep namespace
Posted by: Guest on June-04-2021

Code answers related to "how to know namespace is present or not in kubernetes shell script"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language