阿里云k8s服务简单手动部署

通过阿里云镜像库简单部署应用

1、创建自己的应用镜像(假设创建了 example:latest 镜像)

2、docker 登录阿里云镜像库:

   docker login --username=<youName> registry.cn-hangzhou.aliyuncs.com[镜像地址]

3、输入密码:

4、在本地执行

    docker tag example:latest registry.cn-hangzhou.aliyuncs.com/piglet-test/example:latest
    docker push registry.cn-hangzhou.aliyuncs.com/piglet-test/example:latest

5、本地切换 namespace 并创建应用

    kubens <namspace_name>                 // 使用 kubens 的前提是得安装它,Github上有源码  [ 传送门:https://github.com/ahmetb/kubectx ]
    kubectl run <deployment_name> --image=registry.cn-hangzhou.aliyuncs.com/<images_namespace>/example:latest --port=<服务对外的接口>
使用镜像使用下面其中一条去做,6 用于没有创建应用,7 用于更新已有应用的镜像

6、给deployment添加拉取镜像的权限:在yaml文件中添加

    kubectl edit deployment <deployment_name>  // 先执行此条命令,再在弹出的编辑框中添加如下内容
    
    imagePullSecrets:
    - name: aliyun-secret
    
    kubectl expose deployment <deployment_name> --port=<应用对外暴露的端口>     // 暴露服务

7、更新镜像命令

    kubectl set image deploy/<deployment_name> <deployment_name>=<image_name>:<tag>

转载于:https://www.cnblogs.com/enWelcomeToMyBlogs/p/10172016.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值