Skip to content

Instantly share code, notes, and snippets.

@stevenctl
Created September 1, 2022 19:20
Show Gist options
  • Save stevenctl/6b1065d67421ef09e0850229a33aab91 to your computer and use it in GitHub Desktop.
Save stevenctl/6b1065d67421ef09e0850229a33aab91 to your computer and use it in GitHub Desktop.
istio kind setup
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: istio-localdev
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
endpoint = ["http://kind-registry:5000"]
nodes:
- role: control-plane
- role: worker
- role: worker
#!/usr/bin/env bash
# Copyright 2020 Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
# create registry container unless it already exists
reg_name='kind-registry'
reg_port='5000'
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
if [ "${running}" != 'true' ]; then
docker run \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2
fi
docker network connect "kind" "${reg_name}" || true
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: local-registry-hosting
namespace: kube-public
data:
localRegistryHosting.v1: |
host: "localhost:${reg_port}"
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF
#!/usr/bin/env bash
# Copyright 2020 Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
KIND_CONFIG="${KIND_CONFIG:-./kind-cluster.yaml}"
kind delete cluster --name istio-localdev || true
kind create cluster --config "${KIND_CONFIG}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment