Skip to content

Instantly share code, notes, and snippets.

@jcvenegas
jcvenegas / install_kata_for_ctr.sh
Last active July 20, 2021 20:34
install_kata_for_ctr.sh
#!/bin/bash
# Note containerd should be installed and running.
# Install kata
curl -o kata.tar.xz -L https://github.com/kata-containers/kata-containers/releases/download/2.2.0-alpha1/kata-static-2.2.0-alpha1-x86_64.tar.xz
sudo tar -xf kata.tar.xz -C /
# Add kata binaries to path to allow containerd find them
for b in /opt/kata/bin/* ; do
ln -sf $b /usr/local/bin/$(basename $b)
done
# Configure containerd
@jcvenegas
jcvenegas / lock.rs
Created July 9, 2021 20:08
Rust lock impl using atomic swap
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::thread;
struct Lock {
lock: AtomicBool,
}
impl Lock {
fn lock(&self) {
@jcvenegas
jcvenegas / kata-k8s-run.md
Created April 7, 2021 22:26
Run kata container oneliner using k8s

kubectl run -i --tty --attach --rm --image=ubuntu --overrides='{ "spec": { "runtimeClassName": "kata" } }' ubuntu

@jcvenegas
jcvenegas / setup.sh
Created July 22, 2020 21:24
ubuntu-default-job-2.0
#!/bin/bash
set -e
export ghprbPullId
export ghprbTargetBranch
export DEBUG=true
export CI="true"
export CI_JOB="CRI_CONTAINERD_K8S"
export SHIMV2_TEST="true"
@jcvenegas
jcvenegas / get_logs.sh
Created June 26, 2020 20:55
Debug kata like a pro
# Enable debug of kata (kata-deploy or default path
sudo sed -i 's/#enable_debug = true/enable_debug = true/g' /opt/kata/share/defaults/kata-containers/configuration.toml
sudo sed -i 's/#enable_debug = true/enable_debug = true/g' /usr/share/defaults/kata-containers/configuration.toml
here=$(date +'%Y-%m-%d %H:%M:%S')
# Run what is not working
# Example: docker run ...
journalctl -t kata-hypervisor -t kata-runtime -t virtiofsd --since "${here}" -f | tee container_log
@jcvenegas
jcvenegas / create.sh
Last active June 27, 2020 05:09
azure_create.sh
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
#az login;
vm_name="${1:-}"
if [ "${vm_name}" == "" ]; then
@jcvenegas
jcvenegas / json.json
Last active June 4, 2020 18:58
example-json-badge
{
"setup": "20%"
}
diff --git a/.ci/run.sh b/.ci/run.sh
index 32d8217..caf00a7 100755
--- a/.ci/run.sh
+++ b/.ci/run.sh
@@ -69,12 +69,6 @@ case "${CI_JOB}" in
sudo -E PATH="$PATH" bash -c "make crio"
;;
"CLOUD-HYPERVISOR")
- echo "INFO: Containerd checks"
- sudo -E PATH="$PATH" bash -c "make cri-containerd"
@jcvenegas
jcvenegas / k8s-Expose IP address k8s.md
Last active May 12, 2020 18:25
Errors found when hytpervisor logs are added

http://jenkins.katacontainers.io/job/kata-containers-runtime-clh-minimal-ubuntu-hypervisor-log-stability-testing/23/consoleText

Cause:

Probably long time took to boot and wrong validation if workload is running and workload is listening: I have seen that if the workload is not listening curl will hang and not work.

Possible fixes: I see curl failed, if that happend that means that kubectl wait deployment and kubectl get pods ... | grep Running where done, but I dont see why if are done the runtime logs still are at start stage. Probably was valid but because I dont get at what time curl was launched confuces me .

@jcvenegas
jcvenegas / log.go
Last active March 6, 2020 21:40
Golang: Get stack printed via logrus (useful for logging in syslog)
// Kata runtime example:
// sudo journalctl -t kata-runtime -o json -f | jq .MESSAGE | grep DEBUG --color
import "runtime/debug"
func stackLogger(logger logrus.Entry) {
stack_bytes := debug.Stack()
stack := string(stack_bytes)
for _, l := range strings.Split(stack, "\n") {
logger.Warnf("DEBUG -> %s", l)