3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 # MicroK8s installation
19 sudo snap
install microk8s
--classic
20 sudo usermod
-a -G microk8s ubuntu
22 sudo microk8s.status
--wait-ready
23 sudo microk8s.
enable storage dns
24 # sudo microk8s.enable storage rbac
25 # sudo microk8s.enable storage helm
26 # sudo microk8s.enable storage helm3
29 PRIVATE_IP
=$
(hostname
-I |
awk '{print $1}')
31 sudo microk8s.
enable metallb
:${PRIVATE_IP}-${PRIVATE_IP}
33 # Updates the certificate to allow connections from outside as well (i.e. to the "public" IP).
35 sudo
sed -i "s/\#MOREIPS/IP.3 = ${NEW_K8S_IP}/g" /var
/snap
/microk8s
/current
/certs
/csr.conf.template
36 cat /var
/snap
/microk8s
/current
/certs
/csr.conf.template
37 #sudo microk8s.refresh-certs -i
40 # Retrieves and saves the credentials
41 sudo microk8s.config |
sed "s/server: .*/server: https:\/\/${NEW_K8S_IP}:16443/g" \
42 |
tee ${HOME}/.kube
/config
44 echo Credentials saved
at ${HOME}/.kube
/config