1
1
# Deploy kubernetes via kubeadm.
2
2
# $ limactl start ./k8s.yaml
3
- # $ limactl shell k8s sudo kubectl
3
+ # $ limactl shell k8s kubectl
4
4
5
5
# It can be accessed from the host by exporting the kubeconfig file;
6
6
# the ports are already forwarded automatically by lima:
@@ -126,6 +126,14 @@ provision:
126
126
# Replace the server address with localhost, so that it works also from the host
127
127
sed -e "/server:/ s|https://.*:\([0-9]*\)$|https://127.0.0.1:\1|" -i $KUBECONFIG
128
128
mkdir -p ${HOME:-/root}/.kube && cp -f $KUBECONFIG ${HOME:-/root}/.kube/config
129
+ - mode : system
130
+ script : |
131
+ #!/bin/bash
132
+ set -eux -o pipefail
133
+ export KUBECONFIG=/etc/kubernetes/admin.conf
134
+ mkdir -p ${LIMA_CIDATA_HOME}/.kube
135
+ cp -f $KUBECONFIG ${LIMA_CIDATA_HOME}/.kube/config
136
+ chown -R ${LIMA_CIDATA_USER} ${LIMA_CIDATA_HOME}/.kube
129
137
probes :
130
138
- description : " kubeadm to be installed"
131
139
script : |
@@ -151,15 +159,15 @@ probes:
151
159
script : |
152
160
#!/bin/bash
153
161
set -eux -o pipefail
154
- if ! timeout 300s bash -c "until sudo kubectl version >/dev/null 2>&1; do sleep 3; done"; then
162
+ if ! timeout 300s bash -c "until kubectl version >/dev/null 2>&1; do sleep 3; done"; then
155
163
echo >&2 "kubernetes cluster is not up and running yet"
156
164
exit 1
157
165
fi
158
166
- description : " coredns deployment to be running"
159
167
script : |
160
168
#!/bin/bash
161
169
set -eux -o pipefail
162
- sudo kubectl wait -n kube-system --timeout=180s --for=condition=available deploy coredns
170
+ kubectl wait -n kube-system --timeout=180s --for=condition=available deploy coredns
163
171
copyToHost :
164
172
- guest : " /etc/kubernetes/admin.conf"
165
173
host : " {{.Dir}}/copied-from-guest/kubeconfig.yaml"
0 commit comments