make sure the .kube dir is created #164
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
name: Test Microk8s | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: A job to install MicroK8s | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
microk8s-config.yaml | |
sparse-checkout-cone-mode: false | |
- name: build-image-and-create-microk8s-config | |
run: | | |
mkdir -p $HOME/sideload | |
docker pull alpine:edge | |
docker save alpine:edge > $HOME/sideload/alpine-edge.tar | |
- uses: balchua/microk8s-actions@feat/launch_config | |
with: | |
channel: "1.28/stable" | |
launch-configuration: "$GITHUB_WORKSPACE/microk8s-config.yaml" | |
sideload-images-path: "$HOME/sideload/" | |
- name: Check Side loaded images | |
run: | | |
sudo microk8s ctr images ls | grep alpine:edge | |
sudo microk8s status --wait-ready | |
- name: Check User | |
run: | | |
id | |
sg microk8s -c 'microk8s status' | |
- name: Check push to local registry | |
run: | | |
docker pull busybox:1 | |
echo $REGISTRY_IP | |
docker tag busybox:1 localhost:32000/my-repo/busybox:1 | |
docker push localhost:32000/my-repo/busybox:1 | |
curl http://localhost:32000/v2/_catalog | |
- name: Test MicroK8s | |
id: microk8s | |
run: | | |
set -ex | |
kubectl get no | |
kubectl get pods -A -o wide | |
sleep 120 # Give it sometime before we start checking for pod readiness. | |
# wait for storage pod to be ready | |
kubectl -n kube-system wait --for=condition=ready pod -l k8s-app=hostpath-provisioner --timeout=60s | |
storage_ready=$? | |
if [ $storage_ready -ne 0 ]; then | |
echo "Error storage not ready." | |
exit $storage_ready | |
fi | |
- name: Test MicroK8s commands | |
id: microk8s-commands | |
run: | | |
set -ex | |
echo "Executing microk8s status using sg command." | |
sg microk8s -c 'microk8s status' | |
echo "Executing microk8s status using sudo command." | |
sudo microk8s status |