2 ##############################################################################
3 # Copyright (c) 2020 Huawei Tech and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 KUBERNETES=~/testk8s-kubernetes.yaml
13 cat <<EOF > "${KUBERNETES}"
18 name: kubernets-deployment
39 CLUSTER_INFO=$(kubectl cluster-info)
40 RUNNING_PODS_COUNT=$(kubectl get pods | grep -c -e STATUS -e Running)
42 if [[ $CLUSTER_INFO != "" ]]; then
43 kubectl create -f ~/testk8s-kubernetes.yaml
45 echo "No kubernetes cluster present"
50 echo "Kubectl deployments........................................."
51 kubectl get deployments
53 echo "Kubectl pods in default namespace............................"
56 echo "-------------------------------------------------------------------"
57 echo "-------------------------------------------------------------------"
61 echo "Checking for Pods not in running status in default namespace"
63 if [[ $RUNNING_PODS_COUNT > 0 ]]; then
64 kubectl get pods --field-selector=status.phase!=Running
66 echo "No Pods are presently running"
69 echo "-------------------------------------------------------------------"
70 echo "-------------------------------------------------------------------"