Skip to content
55 changes: 16 additions & 39 deletions bin/y-cluster-provision-k3s-multipass
Original file line number Diff line number Diff line change
Expand Up @@ -31,57 +31,34 @@ export INSTALL_K3S_SKIP_START=true
# For kubectl top to work with metrics-server, https://github.com/rancher/k3s/issues/252#issuecomment-482662774
export INSTALL_K3S_EXEC="--kubelet-arg=address=0.0.0.0"

INSTALLER_REVISION=d8c4f3811e96d75f82bebc82f4ef8f82fbe70637
export INSTALL_K3S_VERSION=v0.8.1
curl -sfL https://github.com/rancher/k3s/raw/$INSTALLER_REVISION/install.sh | sh -

K3S_DATA_DIR=/var/lib/rancher/k3s

# https://github.com/rancher/k3s/issues/145
# https://github.com/rancher/k3s/blob/master/pkg/agent/templates/templates.go
mkdir -p $K3S_DATA_DIR/agent/etc/containerd
cat <<EOF >> $K3S_DATA_DIR/agent/etc/containerd/config.toml.tmpl
[plugins.opt]
path = "{{ .NodeConfig.Containerd.Opt }}"

[plugins.cri]
stream_server_address = "{{ .NodeConfig.AgentConfig.NodeName }}"
stream_server_port = "10010"

[plugins.cri.cni]
bin_dir = "{{ .NodeConfig.AgentConfig.CNIBinDir }}"
conf_dir = "{{ .NodeConfig.AgentConfig.CNIConfDir }}"

[plugins.cri.registry]
[plugins.cri.registry.mirrors]
[plugins.cri.registry.mirrors."builds-registry.ystack.svc.cluster.local"]
endpoint = ["http://builds-registry.ystack.svc.cluster.local"]
[plugins.cri.registry.mirrors."prod-registry.ystack.svc.cluster.local"]
endpoint = ["http://prod-registry.ystack.svc.cluster.local"]
mkdir -p /etc/rancher/k3s
cat <<EOF >> /etc/rancher/k3s/registries.yaml
mirrors:
"builds-registry.ystack.svc.cluster.local":
endpoint:
- http://builds-registry.ystack.svc.cluster.local
"prod-registry.ystack.svc.cluster.local":
endpoint:
- http://prod-registry.ystack.svc.cluster.local
EOF

INSTALLER_REVISION=8833bfd961ff31b7b6de4300b201d01d3fb2bac8
export INSTALL_K3S_VERSION=v0.10.2
curl -sfL https://github.com/rancher/k3s/raw/$INSTALLER_REVISION/install.sh | sh -

service k3s start
k3s crictl info

chmod a+r /etc/rancher/k3s/*

k3s kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.9/deploy/local-path-storage.yaml
cat << EOF | k3s kubectl create -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: standard
provisioner: rancher.io/local-path
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
EOF
k3s kubectl patch storageclass standard -p "{\"metadata\":{\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}"
# The default storage class with k3s >= 0.10 is "local-path"
#k3s kubectl patch storageclass standard -p "{\"metadata\":{\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}"
k3s kubectl get node
k3s kubectl wait --for=condition=Ready node/ystack-master
';

multipass exec "$VM_NAME" -- sudo cat /etc/rancher/k3s/k3s.yaml \
| sed "s|localhost|$K3S_NODEIP_MASTER|" \
| sed "s|127.0.0.1|$K3S_NODEIP_MASTER|" \
> "$KUBECONFIG.tmp"

KUBECONFIG="$KUBECONFIG.tmp" kubectl config rename-context default ystack-k3s
Expand Down
4 changes: 2 additions & 2 deletions kafka/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace: kafka
bases:
- github.com/Yolean/kubernetes-kafka/variants/dev-small?ref=f30ecd9469f531b40d00fd5e2b35fb0faa3a6c31
- github.com/Yolean/kubernetes-kafka/pixy?ref=f30ecd9469f531b40d00fd5e2b35fb0faa3a6c31
- github.com/Yolean/kubernetes-kafka/variants/dev-small?ref=2927b49281a748894368ef0e9f5c83df8259ca40
- github.com/Yolean/kubernetes-kafka/pixy?ref=2927b49281a748894368ef0e9f5c83df8259ca40
4 changes: 2 additions & 2 deletions metrics-server/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: kube-system
bases:
- github.com/y-stack/metrics-server/deploy/1.8+?ref=54b14b78112367c01576f34fc34b3aa33c3098c6
- github.com/y-stack/metrics-server/deploy/1.8+?ref=e9bcc0e8d9de4d4b9d1dbc62a736733577f4a3de
patchesStrategicMerge:
- resource-limits.yaml
- metric-resolution.yaml
#- metric-resolution.yaml
2 changes: 2 additions & 0 deletions registry/generic,minio/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ spec:
value: us-east-1
- name: REGISTRY_STORAGE_S3_BUCKET
value: ystack-builds-registry
- name: REGISTRY_STORAGE_REDIRECT_DISABLE
value: "true"
1 change: 0 additions & 1 deletion registry/generic,minio/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ bases:
- ../node-update-hosts
patchesStrategicMerge:
- deployment.yaml
- minio-host-from-nodes.yaml
15 changes: 0 additions & 15 deletions registry/generic,minio/minio-host-from-nodes.yaml

This file was deleted.