-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
# https://docs.github.com/en/actions/using-jobs/using-concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ matrix.kube-version }} | ||
cancel-in-progress: true | ||
|
||
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kube-release: | ||
- 1.23 | ||
|
||
continue-on-error: false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install conntrack | ||
run: | | ||
sudo apt update | ||
sudo apt install -y conntrack | ||
# Install Kubernetes use apt source with specified version | ||
- name: Install Kubernetes | ||
run: | | ||
sudo snap install kubelet --channel=${{ matrix.kube-release }}/stable --classic | ||
sudo snap install kubectl --channel=${{ matrix.kube-release }}/stable --classic | ||
sudo snap install kubeadm --channel=${{ matrix.kube-release }}/stable --classic | ||
wget -O crictl-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/v${{ matrix.kube-release }}.0/crictl-v${{ matrix.kube-release }}.0-linux-amd64.tar.gz && \ | ||
sudo tar zxvf crictl-linux-amd64.tar.gz -C /usr/local/bin && \ | ||
rm -f crictl-linux-amd64.tar.gz | ||
- name: Swap off | ||
run: | | ||
sudo swapoff -a | ||
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab | ||
- name: Start Kubelet | ||
run: | | ||
sudo wget -O /etc/systemd/system/kubelet.service https://github.com/kubernetes/release/raw/master/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service | ||
sudo mkdir /etc/systemd/system/kubelet.service.d/ | ||
sudo wget -O /etc/systemd/system/kubelet.service.d/10-kubeadm.conf https://github.com/kubernetes/release/raw/master/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf | ||
sudo mkdir /var/lib/kubelet/ | ||
sudo echo 'KUBELET_KUBEADM_ARGS=""' > /var/lib/kubelet/kubeadm-flags.env | ||
sudo systemctl daemon-reload | ||
sudo systemctl restart kubelet | ||
sudo journalctl -u kubelet | ||
sudo systemctl status kubelet | ||
- name: Initialize Kubernetes | ||
run: | | ||
sudo kubeadm init || { | ||
journalctl -xeu kubelet | ||
exit 1 | ||
} | ||
- name: Setup kubeconfig | ||
run: | | ||
mkdir -p $HOME/.kube | ||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | ||
sudo chown $(id -u):$(id -g) $HOME/.kube/config | ||
- name: Get pods | ||
run: | | ||
kubectl get pods -o wide --all-namespaces | ||
- name: Get nodes | ||
run: | | ||
kubectl get nodes -o wide |