Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--insecure-registry does not work with cri-o when using kicbase image #13932

Closed
criztovyl opened this issue Apr 9, 2022 · 8 comments
Closed
Labels
co/runtime/crio CRIO related issues kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@criztovyl
Copy link
Contributor

criztovyl commented Apr 9, 2022

when creating a minikube instance using kic driver it looks like the --insecure-registry options are injected to /etc/sysconfig/crio.minikube:

func setCrioOptions(p provision.SSHCommander) error {
// pass through --insecure-registry
var (
crioOptsTmpl = `
CRIO_MINIKUBE_OPTIONS='{{ range .EngineOptions.InsecureRegistry }}--insecure-registry {{.}} {{ end }}'
`
crioOptsPath = "/etc/sysconfig/crio.minikube"
)
t, err := template.New("crioOpts").Parse(crioOptsTmpl)
if err != nil {
return err
}
var crioOptsBuf bytes.Buffer
if err := t.Execute(&crioOptsBuf, p); err != nil {
return err
}
if _, err = p.SSHCommand(fmt.Sprintf("sudo mkdir -p %s && printf %%s \"%s\" | sudo tee %s && sudo systemctl restart crio", path.Dir(crioOptsPath), crioOptsBuf.String(), crioOptsPath)); err != nil {
return err
}
return nil
}

But the crio.service in the kcibase image does not include that file:

$ sudo podman ps
CONTAINER ID  IMAGE                                COMMAND  CREATED      STATUS          PORTS                                                                                                                                 NAMES
bdf7c0ce6328  gcr.io/k8s-minikube/kicbase:v0.0.30           5 hours ago  Up 5 hours ago  127.0.0.1:32883->22/tcp, 127.0.0.1:42673->2376/tcp, 127.0.0.1:34131->5000/tcp, 127.0.0.1:44439->8443/tcp, 127.0.0.1:44799->32443/tcp  minikube

$ minikube config view
- container-runtime: cri-o
- driver: podman
- insecure-registry: host.minikube.internal:5000

$ sudo podman exec minikube bash -c "cat /etc/sysconfig/crio.minikube"

CRIO_MINIKUBE_OPTIONS='--insecure-registry 10.96.0.0/12 --insecure-registry host.minikube.internal:5000 '

# https://manpages.ubuntu.com/manpages/bionic/man5/systemd.unit.5.html#unit%20file%20load%20path
$ sudo podman exec minikube bash -c "tail -n+0 {/etc/systemd/system,/run/systemd/system,/lib/systemd/system}/crio.service"
tail: cannot open '/etc/systemd/system/crio.service' for reading: No such file or directory
tail: cannot open '/run/systemd/system/crio.service' for reading: No such file or directory
==> /lib/systemd/system/crio.service <==
[Unit]
Description=Container Runtime Interface for OCI (CRI-O)
Documentation=https://github.com/cri-o/cri-o
Wants=network-online.target
Before=kubelet.service
After=network-online.target

[Service]
Type=notify
EnvironmentFile=-/etc/default/crio
Environment=GOTRACEBACK=crash
ExecStart=/usr/bin/crio \
          $CRIO_CONFIG_OPTIONS \
          $CRIO_RUNTIME_OPTIONS \
          $CRIO_STORAGE_OPTIONS \
          $CRIO_NETWORK_OPTIONS \
          $CRIO_METRICS_OPTIONS
ExecReload=/bin/kill -s HUP $MAINPID
TasksMax=infinity
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
OOMScoreAdjust=-999
TimeoutStartSec=0
Restart=on-abnormal

[Install]
WantedBy=multi-user.target
Alias=cri-o.service
@criztovyl
Copy link
Contributor Author

criztovyl commented Apr 9, 2022

this is similar to #11729, but there crio.service was still reachable via /etc/systemd/system/multi-user.target.wants/crio.service -- which it no longer is. this suggests something changed in the image.
edit: #11729 is --vm-driver=kvm2, I am using --driver=podman.

@criztovyl criztovyl changed the title --insecure-registry does not work with cri-o --insecure-registry does not work with cri-o when using kicbase image Apr 9, 2022
@afbjorklund afbjorklund added kind/bug Categorizes issue or PR as related to a bug. co/runtime/crio CRIO related issues labels Apr 10, 2022
@afbjorklund
Copy link
Collaborator

afbjorklund commented Apr 10, 2022

Different packaging, with the custom /etc/sysconfig/crio.minikube versus the vendor /etc/default/crio

EnvironmentFile=-/etc/sysconfig/crio
EnvironmentFile=-/etc/sysconfig/crio.minikube
EnvironmentFile=/var/run/minikube/env
ExecStart=/usr/bin/crio \
    $CRIO_OPTIONS \
    $CRIO_MINIKUBE_OPTIONS
EnvironmentFile=-/etc/default/crio
ExecStart=/usr/bin/crio \
          $CRIO_CONFIG_OPTIONS \
          $CRIO_RUNTIME_OPTIONS \
          $CRIO_STORAGE_OPTIONS \
          $CRIO_NETWORK_OPTIONS \
          $CRIO_METRICS_OPTIONS

Moving the config to /etc/default and adding to the ISO package, seems like the easiest workaround ?

@afbjorklund
Copy link
Collaborator

afbjorklund commented Apr 10, 2022

@afbjorklund afbjorklund added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Apr 10, 2022
@criztovyl
Copy link
Contributor Author

criztovyl commented Apr 10, 2022

workaround is

minishift ssh "echo 'CRIO_CONFIG_OPTIONS=--insecure-registry host.minikube.internal:5000' | sudo tee -a /etc/default/crio >/dev/null; sudo systemctl restart crio"

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 9, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 8, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/runtime/crio CRIO related issues kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

4 participants