Last active
November 11, 2021 08:54
-
-
Save danpawlik/675b2228635b1fd00063aa25a613e188 to your computer and use it in GitHub Desktop.
Setup Kind k8s cluster on Centos 7 with podman
This file contains hidden or 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 | |
| ADDITIONAL_TOOLS=${ADDITIONAL_TOOLS:-$1} | |
| KIND_VERSION=${KIND_VERSION:-'v0.11.1'} | |
| KINDEST_IMAGE=${KINDEST_IMAGE:-'kindest/node:v1.20.0'} | |
| DOCKER_LOGIN=${DOCKER_LOGIN:-''} | |
| DOCKER_PASSWORD=${DOCKER_PASSWORD:-''} | |
| cat << 'EOF' | sudo tee /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo | |
| [devel_kubic_libcontainers_stable] | |
| name=Stable Releases of Upstream github.com/containers packages (CentOS_7) | |
| type=rpm-md | |
| baseurl=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/ | |
| gpgcheck=1 | |
| gpgkey=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/repodata/repomd.xml.key | |
| enabled=1 | |
| EOF | |
| sudo yum update -y | |
| sudo yum -y install podman | |
| # podman login docker.io | |
| if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ]; then | |
| podman login docker.io -u"$DOCKER_LOGIN" -p"$DOCKER_PASSWORD" | |
| fi | |
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/$KIND_VERSION/kind-linux-amd64 | |
| curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | |
| chmod +x kubectl kind | |
| sudo mv {kubectl,kind} /usr/bin/ | |
| if [ -n "${ADDITIONAL_TOOLS}" ]; then | |
| # kompose | |
| curl -L https://github.com/kubernetes/kompose/releases/download/v1.21.0/kompose-linux-amd64 -o kompose | |
| chmod +x kompose | |
| sudo mv kompose /usr/bin/ | |
| # Kustomize | |
| curl -LO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.2.0/kustomize_v4.2.0_linux_amd64.tar.gz | |
| tar xaf kustomize_v4.2.0_linux_amd64.tar.gz | |
| mv kustomize /usr/bin/ | |
| ## kubebuilder | |
| sudo yum install -y golang || sudo yum install -y epel-release && sudo yum install -y golang | |
| curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/$(go env GOOS)/$(go env GOARCH) | |
| chmod +x kubebuilder | |
| sudo mv kubebuilder /usr/bin/ | |
| ## noobaa | |
| curl -L https://github.com/noobaa/noobaa-operator/releases/download/v5.7.0/noobaa-linux-v5.7.0 -o noobaa | |
| chmod +x noobaa | |
| sudo mv noobaa /usr/bin | |
| ## opm | |
| curl -LO https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.6/opm-linux.tar.gz | |
| tar xaf opm-linux.tar.gz | |
| sudo mv opm /usr/bin/ | |
| fi | |
| KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --image $KINDEST_IMAGE --wait 2m --name my-kind-cluster | |
| kind get kubeconfig --name my-kind-cluster > kubeconfig | |
| export KUBE_CONFIG=kubeconfig | |
| kubectl get pods --all-namespaces |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment