openshift重启后,以系统管理员system:admin登录系统,提示要输入密码问题解决方案

本文详细解析了在使用Openshift容器云平台时,system:admin账户因环境变量与启动目录不匹配导致的免密登录失败问题。通过调整openshift start命令执行路径与/etc/profile中KUBECONFIG、CURL_CA_BUNDLE变量指向的一致性,成功解决了system:admin账户的登录障碍。

问题描述:当我们关闭掉openshift容器云,在下一次通过 openshift  start  &  命令启动openshift后,想通过system:admin登录系统发现openshift提示用户要输入密码,由于system:admin是通过密钥证书免密登录系统的,所以此处会出现system:admin无法登录openshift的问题。

如下图分别是执行openshift  start & 命令在 /  根目录   而/etc/profile中

KUBECONFIG  、CURL_CA_BUNDLE变量中设置的openshift.local.config 所在的目录是/home,两者不一致,导致system:admin免密登录失败。

 

问题解决通过openshift  start   &  启动openshift,执行此命令的所在的目录要与/etc/profile中KUBECONFIG  、CURL_CA_BUNDLE变量中设置的openshift.local.config 所在的目录保持一致。

例如,我这里的openshift.local.config在/home目录,那么启动openshift的命令openshift start &就要在/home目录执行,如果我在其他目录执行此命令启动openshift ,就会出现system:admin账号无法登陆openshift

export KUBECONFIG=/home/openshift.local.config/master/admin.kubeconfig
export CURL_CA_BUNDLE=/home/openshift.local.config/master/ca.crt


 

 

如下图分别是执行openshift  start &命令在 /home目录   而/etc/profile中

KUBECONFIG  、CURL_CA_BUNDLE变量中设置的openshift.local.config 所在目录是/home,两者不一致,所以system:admin免密登录成功!

附上:我的linux服务器配置的/etc/profile文件内容如下:

if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /home/profile.d/*.sh /home/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then 
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge
export PATH=/home/openshift:$PATH
export KUBECONFIG=/home/openshift.local.config/master/admin.kubeconfig
export CURL_CA_BUNDLE=/home/openshift.local.config/master/ca.crt
sudo chmod +r /home/openshift.local.config/master/admin.kubeconfig

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

成伟平2022

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值