This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the following from API Master node | |
APISERVER=https://$(kubectl -n default get endpoints kubernetes --no-headers | awk '{ print $2 }') | |
SERVICE_ACCOUNT=hpecp-bootstrap | |
SECRET=$(kubectl -n hpecp-bootstrap get serviceaccount ${SERVICE_ACCOUNT} -o jsonpath='{.secrets[].name}') | |
TOKEN=$(kubectl -n hpecp-bootstrap get secret ${SECRET} -o jsonpath={.data.token} | base64 -d) | |
kubectl -n hpecp-bootstrap get secret ${SECRET} -o jsonpath='{.data.ca\.crt}' | base64 -d > /tmp/ca.crt | |
STS_NAMES=$(curl -s $APISERVER/apis/apps/v1/namespaces/hpecp/statefulsets?limit=1000 --header "Authorization: Bearer $TOKEN" --cacert /tmp/ca.crt | jq -rM '.items[].metadata.name') | |
for name in $STS_NAMES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: settings.k8s.io/v1alpha1 | |
kind: PodPreset | |
metadata: | |
name: tz-mount | |
namespace: hpecp | |
spec: | |
selector: | |
matchExpressions: | |
- key: kubedirector.hpe.com/role | |
operator: In |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Local Storage PV | |
cat <<EOF | kubectl apply -f - | |
kind: StorageClass | |
apiVersion: storage.k8s.io/v1 | |
metadata: | |
name: local-storage | |
provisioner: kubernetes.io/no-provisioner | |
volumeBindingMode: WaitForFirstConsumer | |
EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure macvlan cni driver is installed on all hosts under /opt/cni/bin | |
# ls -l /opt/cni/bin/macvlan. Follow these steps to install macvlan driver if not present already | |
# On each k8s master/worker nodes, do the following | |
cd /tmp | |
mkdir -p cni-plugins | |
cd cni-plugins | |
curl -LO https://github.com/containernetworking/plugins/releases/download/v0.8.6/cni-plugins-linux-amd64-v0.8.6.tgz | |
tar xvfz cni-plugins-linux-amd64-v0.8.6.tgz | |
cp macvlan /opt/cni/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ALL_BUCKETS=$(aws s3 ls s3:// | awk '{print $3}') | |
for bucket in $ALL_BUCKETS | |
do | |
echo "BUCKET: $bucket" | |
aws s3 ls s3://$bucket --recursive --human-readable --summarize | tail -2 | |
echo | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install cryptsetup -y | |
DEVICE_NAME="/dev/xvdb" | |
PASSWORD="dummy password" | |
# Create a secret key file | |
mkdir -p /etc/luks-keys | |
echo "$PASSWORD" > /etc/luks-keys/secret | |
cat /etc/luks-keys/secret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This document assumes following information is available for configuring routable ips | |
# for containers | |
# Primary interface to use | |
# Primary Subnet | |
# External Gateway ip | |
# Two static ipaddresses for the containers to use | |
# Ensure that primary nic is enabled with promiscuous mode. | |
# For ESX based vms, this has to be done from the vSwitch. For baremetal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOT_RUNNING=$(kubectl get pods --no-headers -A | grep -v Running | awk '{printf "%s:%s\n", $1, $2}') | |
for not_running in $NOT_RUNNING | |
do | |
NS=$(echo $not_running | cut -d':' -f1) | |
POD=$(echo $not_running | cut -d':' -f2) | |
echo "deleting pod $NS:$POD" | |
kubectl -n $NS delete pod $POD | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
DEPLOYMENT_NAME="$1" | |
OP="$2" | |
if [ "$OP" == "stop" ] | |
then | |
EC2_OP="aws ec2 stop-instances --instance-ids" | |
else | |
EC2_OP="aws ec2 start-instances --instance-ids" | |
fi |