首页 > 其他分享 >EKS1.26 使用 ECR 存储镜像

EKS1.26 使用 ECR 存储镜像

时间:2023-05-22 10:03:23浏览次数:39  
标签:权限 示例 EKS1.26 ecr jenkins 镜像 latest com ECR

使用eks node iam解决 ecr相关使用问题

权限示例 关键字AmazonEC2Container 官方托管策略选择合适即可 示例:AmazonEC2ContainerRegistryReadOnly

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ecr:GetAuthorizationToken",
                "ecr:BatchCheckLayerAvailability",
                "ecr:GetDownloadUrlForLayer",
                "ecr:GetRepositoryPolicy",
                "ecr:DescribeRepositories",
                "ecr:ListImages",
                "ecr:DescribeImages",
                "ecr:BatchGetImage",
                "ecr:GetLifecyclePolicy",
                "ecr:GetLifecyclePolicyPreview",
                "ecr:ListTagsForResource",
                "ecr:DescribeImageScanFindings"
            ],
            "Resource": "*"
        }
    ]
}

此策略无创建权限,只能pull 所以需要找台机器授权 一般用CICD机器的来做 (jenkins)

参考link:https://docs.aws.amazon.com/zh_cn/AmazonECR/latest/userguide/getting-started-cli.html 两种方式:

1. jenkins 机器配置aws cli 认证 配置ecr令牌有效期为 12 小时 ,所以使用计划任务来实现 (推荐)
2. jenkins 插件实现 link: https://plugins.jenkins.io/amazon-ecr/ (如果想权限最小化管理时推荐)

测试效果

推送成功后 docker push xxxxxxx.dkr.ecr.xxxx.amazonaws.com/nginx1:latest

测试pod 拉起镜像 kubectl apply -f pod1.yaml

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: xxxxxxx.dkr.ecr.xxxxx.amazonaws.com/nginx1:latest
    ports:
    - containerPort: 80

标签:权限,示例,EKS1.26,ecr,jenkins,镜像,latest,com,ECR
From: https://blog.51cto.com/u_15376515/6320999

相关文章

  • Linux安装Ubuntu镜像,常用命令、IP配置等
    Ubuntu1.系统安装ubuntu安装步骤:部分版本分辨率问题显示不全,可以先试用,点击右上角修改分辨率,再安装2.登录ubuntu只能登录创建系统的用户为root修改密码:sudopasswdroot切换root用户:1.sudo-i-uroot2.sudosu3.配置IP安装后尝试pingwww.baidu.com(安装后自动获......
  • 当k8s拉镜像出现问题时 需要修改 /etc/containerd/config.toml 配置
    找到plugins."io.containerd.grpc.v1.cri".registry添加此两处配置 [plugins."io.containerd.grpc.v1.cri".registry.configs][plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.16.185:8088".tls]insecu......
  • Dockerfile练习二---------------------------构建自己的mysql镜像
    构建自己的mysql镜像 ##NYSQL的shell安装脚本##[root@dockertomcat]#cd~[root@docker~]#mkdirmysql[root@docker~]#cdmysql/[root@dockermysql]#vimrun.sh#!/bin/bashyum-yinstall\ncurses\ncurses-devel\bison\cmake\make\gcc\gcc-c++cd/optcdmysql-5......
  • docker生成nginx镜像
    dockerrun-d-p80:80\-p8088:8088\-v/home/xxx/xxx/xxx/conf/nginx.conf:/etc/nginx/nginx.conf\-v/home/xxx/xxx/xxx/dist:/home/usc/dist\--namenginx\nginx:latest#-p指定端口-v挂载目录--name指定容器的名称nginx:latest指定镜像的版......
  • Dockefile构建镜像语法:
    1.构建nginx镜像#BaseimageFROMcentos:7#MAINTAINERMAINTAINERcbmiao<[email protected]>#将nginx以及pcre源代码加入镜像ADDnginx-1.20.1.tar.gz/usr/local/src/ADDpcre-8.45.tar.gz/usr/local/src/#安装编译器RUNyuminstall-ygccgcc-c++makeopens......
  • 使用国内镜像通过pip安装python 包
    pip安装python包时超时或是报错“CannotfetchindexbaseURLhttp://e.pypi.python.org/simple/”解决方法:加上参数"-i http://pypi.v2ex.com/simple",即换成国内镜像。一劳永逸的办法:~/.pip/下创建文件pip.conf(如果还没有的话),并填入以下内容:1[global]2timeout=6......
  • nodejs npm国内镜像
    镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):1.通过config命令npmconfigsetregistryhttp://registry.cnpmjs.orgnpminfounderscore(如果上面配置正确这个命令会有字符串response)2.命令行指定npm--registryhttp://registry.cn......
  • 删除docker images中为none的镜像
    查看现有镜像➜safelinedockerimagesREPOSITORYTAGIMAGEIDCREATEDSIZEchaitin/safeline-tengine1.5.125a6146e6aed13hoursago119MBchaitin/safeline-tenginelatest25a6146e6aed13hoursago119M......
  • Kali学习—修改Kali镜像源
    KaliLinux是一款基于Debian的Linux操作系统,由于其强大的安全测试及渗透测试工具而广受欢迎。国内用户可以使用以下KaliLinux镜像源来加速软件包更新和安装:清华大学镜像站:https://mirrors.tuna.tsinghua.edu.cn/kali/中科大镜像站:http://mirrors.ustc.edu.cn/kali/阿里......
  • KVM虚拟及无法启动,磁盘镜像完整情况下导出文件
     使用copy-out命令将虚拟机文件系统中的文件复制到主机上:><fs>copy-out/path/to/vm/file/path/to/host/directory其中/path/to/vm/file是要导出的虚拟机文件的路径,/path/to/host/directory是要保存到主机上的目录路径。例如,/tmp目录。当完成操作后,务必断开gues......