Last active
July 16, 2019 17:53
-
-
Save grahamwhaley/9eaba46d78288f99e42f52670e57a5f9 to your computer and use it in GitHub Desktop.
Quick script to apply kata_deploy to k8s
This file contains 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 | |
# Copyright (c) 2019 Intel Corporation | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# applies kata-deploy to the default kubectl cluster | |
set -e | |
#set -x | |
GOPATH=${GOPATH:-${HOME}/go} | |
packaging=github.com/kata-containers/packaging | |
kd_path=${GOPATH}/src/github.com/kata-containers/packaging/kata-deploy | |
go get -d -u ${packaging} || true | |
kubectl get nodes | |
kubectl get RuntimeClass | |
kubectl apply -f ${kd_path}/kata-rbac.yaml | |
kubectl apply -f ${kd_path}/kata-deploy.yaml | |
for retry in $(seq 1 10); do | |
echo "Checking kata deploy status" | |
podname=$(kubectl -n kube-system get pods -o=name | fgrep kata-deploy | sed 's?pod/??') | |
count=$(kubectl -n kube-system exec ${podname} -- ps -ef | fgrep -c infinity) | |
if [ $count -ne 0 ]; then | |
echo "Kata deploy finished.." | |
kata_deployed="yes" | |
break | |
else | |
sleep 10 | |
fi | |
done | |
if [ "$kata_deployed" != "yes" ]; then | |
echo "Failed to deploy kata-deploy" | |
exit 1 | |
fi | |
kubectl apply -f ${kd_path}/k8s-1.14/kata-qemu-runtimeClass.yaml | |
kubectl get RuntimeClass | |
echo "Listing all nodes which have the Kata label applied" | |
kubectl get nodes -l katacontainers.io/kata-runtime=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment