We are trying to install microk8s in Centos 7.9 and it wont start. We get an error message as below:
# snap --version
snap 2.57.6-2.el7
snapd 2.57.6-2.el7
series 16
centos 7
kernel 3.10.0-1160.81.1.el7.x86_64
# microk8s version
MicroK8s v1.26.1 revision 4595
[root@ ~]# snap logs microk8s
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: File "/snap/microk8s/4595/usr/lib/python3/dist-packages/click/_unicodefun.py", line 118, in _verify_python3_env
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: 'for mitigation steps.' + extra)
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: This system lists a couple of UTF-8 supporting locales that
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: you can pick from. The following suitable locales where
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: discovered: aa_DJ.utf8, aa_ER.utf8, aa_ET.utf8, af_ZA.utf8, am_ET.utf8, an_ES.utf8, ar_AE.utf8, ar_BH.utf8, ar_DZ.utf8, ar_EG.utf8, ar_IN.utf8, ar_IQ.utf8, ar_JO.utf8, ar_KW.utf8, ar_LB.utf8, ar_LY.utf8, ar_MA.utf8, ar_OM.utf8, ar_QA.utf8, ar_SA.utf8, ar_SD.utf8, ar_SY.utf8, ar_TN.utf8, ar_YE.utf8, as_IN.utf8, ast_ES.utf8, ayc_PE.utf8, az_AZ.utf8, be_BY.utf8, bem_ZM.utf8, ber_DZ.utf8, ber_MA.utf8, bg_BG.utf8, bho_IN.utf8, bn_BD.utf8, bn_IN.utf8, bo_CN.utf8, bo_IN.utf8, br_FR.utf8, brx_IN.utf8, bs_BA.utf8, byn_ER.utf8, ca_AD.utf8, ca_ES.utf8, ca_FR.utf8, ca_IT.utf8, crh_UA.utf8, cs_CZ.utf8, csb_PL.utf8, cv_RU.utf8, cy_GB.utf8, da_DK.utf8, de_AT.utf8, de_BE.utf8, de_CH.utf8, de_DE.utf8, de_LU.utf8, doi_IN.utf8, dv_MV.utf8, dz_BT.utf8, el_CY.utf8, el_GR.utf8, en_AG.utf8, en_AU.utf8, en_BW.utf8, en_CA.utf8, en_DK.utf8, en_GB.utf8, en_HK.utf8, en_IE.utf8, en_IN.utf8, en_NG.utf8, en_NZ.utf8, en_PH.utf8, en_SG.utf8, en_US.utf8, en_ZA.utf8, en_ZM.utf8, en_ZW.utf8, es_AR.utf8, es_BO.utf8, es_CL.utf8, es_CO.utf8, es_CR.utf8, es_CU.utf8, es_DO.utf8, es_EC.utf8, es_ES.utf8, es_GT.utf8, es_HN.utf8, es_MX.utf8, es_NI.utf8, es_PA.utf8, es_PE.utf8, es_PR.utf8, es_PY.utf8, es_SV.utf8, es_US.utf8, es_UY.utf8, xh_ZA.utf8, yi_US.utf8, yo_NG.utf8, yue_HK.utf8, zh_CN.utf8, zh_HK.utf8, zh_SG.utf8, zh_TW.utf8, zu_ZA.utf8
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: Click discovered that you exported a UTF-8 locale
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: but the locale system could not pick up from it because
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: it does not exist. The exported locale is "C.UTF-8" but it
2023-02-13T19:21:58-05:00 microk8s.daemon-apiserver-kicker[16637]: is not supported
This error was resolved in Centos 7.9 after adding the below variables to /etc/environment and logoff/logon as root. Reboot was not needed.
$ cat /etc/environment
LANG=en_US.utf8
LC_ALL=en_US.utf8
See more discussion in https://github.com/canonical/microk8s/issues/3760