Skip to content

Instantly share code, notes, and snippets.

@grahamwhaley
Last active July 16, 2019 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamwhaley/9eaba46d78288f99e42f52670e57a5f9 to your computer and use it in GitHub Desktop.
Save grahamwhaley/9eaba46d78288f99e42f52670e57a5f9 to your computer and use it in GitHub Desktop.
Quick script to apply kata_deploy to k8s
#!/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