Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save MatrixManAtYrService/a763339871aa495be6d13c9c311fdd79 to your computer and use it in GitHub Desktop.

Select an option

Save MatrixManAtYrService/a763339871aa495be6d13c9c311fdd79 to your computer and use it in GitHub Desktop.
kaniko hangs
version: 2.1
jobs:
my-job:
machine:
image: ubuntu-2004:202107-02
steps:
- checkout
- run:
name: snap install
command: sudo snap install microk8s --classic
- run:
name: "get config"
command: |
mkdir -p ~/.kube/
sudo microk8s config >> ~/.kube/config
- run:
name: "enable microk8s features"
command: sudo microk8s enable dns storage
- run:
name: "install kubectl"
command: |
cd ~/bin
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
- run:
name: "install helm"
command: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- run:
name: "prepare networking"
command: |
sudo snap install yq
KUBE_IP=$(cat ~/.kube/config \
| yq e '.clusters[0].cluster.server' - \
| cut -d '/' -f3 \
| cut -d ':' -f1)
echo " [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"${KUBE_IP}:30500\"]
endpoint = [\"http://${KUBE_IP}:30500\"]" | sudo tee -a /var/snap/microk8s/current/args/containerd-template.toml
sudo microk8s stop
sudo microk8s start
- run:
name: "do the thing"
command: |
# the commands in this section are not exactly how I replicate this
# I copied them from the output of a script which does many irrelevant things
# but they tell the story at least
# deply the registry
helm repo add twuni https://helm.twun.io
helm install tb11c-registry --namespace tb11c-meta twuni/docker-registry
cat << 'EOF' | kubectl apply -n tb11c-meta -f -
apiVersion: v1
kind: Service
metadata:
name: tb11c-meta-image-registry
spec:
ports:
- nodePort: 30500
port: 5000
targetPort: 5000
selector:
app: docker-registry
type: NodePort
EOF
# build the image
export KUBECTL_COMMAND_HEADERS=false # https://github.com/kubernetes/kubectl/issues/1098
export KUBECONFIG=/home/circleci/.kube/config
mdkir -p tmp
cd tmp
echo 'FROM alpine
RUN echo hello > foo' > Dockerfile
tar -cf - * | gzip -9 | \
kubectl run -n tb11c-work-fausvfd build-zyszeia --restart=Never -i \
--image=gcr.io/kaniko-project/executor:latest \
-- --destination 10.1.119.6:5000/imgname:tagname \
--build-arg=CACHE_BUST=$(date +s%) \
--cache=true \
--cache-ttl=48h \
--context tar://stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment