Skip to content

Commit 7373f0c

Browse files
authored
Use k3s with containerd (kubernetes#2529)
Seems like in 1.29 there are issues with cri-dockerd. There's no reason to use Docker anymore and this commit makes sure k3s uses containerd.
1 parent 64b8130 commit 7373f0c

6 files changed

Lines changed: 27 additions & 21 deletions

File tree

tests/playbooks/roles/install-docker-registry/tasks/main.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
cmd: |
3434
cfssl gencert -initca ca-csr.json | cfssljson -bare ca -
3535
36+
- name: Create server certificate
37+
shell:
38+
executable: /bin/bash
39+
chdir: "{{ ansible_user_dir }}/certs"
40+
creates: "{{ ansible_user_dir }}/certs/server.pem"
41+
cmd: |
42+
cfssl gencert -config ca-config.json -profile server -ca ./ca.pem -ca-key ./ca-key.pem ca-csr.json | cfssljson -bare server
43+
3644
- name: Run docker registry container
3745
shell:
3846
executable: /bin/bash
@@ -44,8 +52,8 @@
4452
--name registry \
4553
-v "{{ ansible_user_dir }}/certs":/certs \
4654
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
47-
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/ca.pem \
48-
-e REGISTRY_HTTP_TLS_KEY=/certs/ca-key.pem \
55+
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/server.pem \
56+
-e REGISTRY_HTTP_TLS_KEY=/certs/server-key.pem \
4957
-p 443:443 \
5058
registry:2
5159
fi

tests/playbooks/roles/install-docker-registry/templates/ca-config.json.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
"usages": [
1010
"signing",
1111
"key encipherment",
12-
"server auth"
12+
"server auth",
13+
"digital signature"
1314
]
1415
},
1516
"client": {
1617
"expiry": "8760h",
1718
"usages": [
1819
"signing",
1920
"key encipherment",
20-
"client auth"
21+
"client auth",
22+
"digital signature"
2123
]
2224
}
2325
}

tests/playbooks/roles/install-k3s/tasks/main.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,17 @@
8888
manage_etc_hosts: "localhost"
8989
package_update: true
9090
runcmd:
91-
- curl -sSL https://get.docker.com/ | sh
91+
- update-ca-certificates
9292
- mkdir -p /var/lib/rancher/k3s/agent/images/
9393
- curl -sSL https://github.com/k3s-io/k3s/releases/download/{{ k3s_release }}/k3s-airgap-images-amd64.tar -o /var/lib/rancher/k3s/agent/images/k3s-airgap-images.tar
9494
- curl -sSL https://github.com/k3s-io/k3s/releases/download/{{ k3s_release }}/k3s -o /usr/local/bin/k3s
9595
- curl -sSL https://get.k3s.io -o /var/lib/rancher/k3s/install.sh
9696
- chmod u+x /var/lib/rancher/k3s/install.sh /usr/local/bin/k3s
97-
- INSTALL_K3S_SKIP_DOWNLOAD=true /var/lib/rancher/k3s/install.sh --docker --disable traefik --disable metrics-server --disable servicelb --disable-cloud-controller --kubelet-arg="cloud-provider=external" --tls-san {{ k3s_fip }} --token {{ cluster_token }}
97+
- INSTALL_K3S_SKIP_DOWNLOAD=true /var/lib/rancher/k3s/install.sh --disable traefik --disable metrics-server --disable servicelb --disable-cloud-controller --kubelet-arg="cloud-provider=external" --tls-san {{ k3s_fip }} --token {{ cluster_token }}
9898
write_files:
99-
- path: /etc/docker/daemon.json
99+
- path: /usr/local/share/ca-certificates/registry-ca.crt
100100
content: |
101-
{
102-
"insecure-registries" : ["{{ ansible_default_ipv4.address }}"]
103-
}
101+
$(awk '{printf " %s\n", $0}' < /root/certs/ca.pem)
104102
EOF
105103
106104
# Create k3s master
@@ -126,19 +124,17 @@
126124
manage_etc_hosts: "localhost"
127125
package_update: true
128126
runcmd:
129-
- curl -sSL https://get.docker.com/ | sh
127+
- update-ca-certificates
130128
- mkdir -p /var/lib/rancher/k3s/agent/images/
131129
- curl -sSL https://github.com/k3s-io/k3s/releases/download/{{ release.stdout }}/k3s-airgap-images-amd64.tar -o /var/lib/rancher/k3s/agent/images/k3s-airgap-images.tar
132130
- curl -sSL https://github.com/k3s-io/k3s/releases/download/{{ release.stdout }}/k3s -o /usr/local/bin/k3s
133131
- curl -sSL https://get.k3s.io -o /var/lib/rancher/k3s/install.sh
134132
- chmod u+x /var/lib/rancher/k3s/install.sh /usr/local/bin/k3s
135133
- INSTALL_K3S_SKIP_DOWNLOAD=true K3S_URL=https://{{ k3s_fip }}:6443 K3S_TOKEN={{ cluster_token }} /var/lib/rancher/k3s/install.sh --docker --kubelet-arg="cloud-provider=external"
136134
write_files:
137-
- path: /etc/docker/daemon.json
135+
- path: /usr/local/share/ca-certificates/registry-ca.crt
138136
content: |
139-
{
140-
"insecure-registries" : ["{{ ansible_default_ipv4.address }}"]
141-
}
137+
$(awk '{printf " %s\n", $0}' < /root/certs/ca.pem)
142138
EOF
143139
144140
# Create k3s worker

tests/playbooks/test-csi-cinder-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
- neutron
1818
- glance
1919
- cinder
20-
- role: install-k3s
21-
worker_node_count: 0
2220
- role: install-docker
2321
- role: install-docker-registry
2422
cert_hosts: ' ["{{ ansible_default_ipv4.address }}"]'
23+
- role: install-k3s
24+
worker_node_count: 0
2525
- role: install-cpo-occm
2626
run_e2e: false
2727
environment: "{{ global_env }}"

tests/playbooks/test-csi-manila-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
- neutron
1717
- glance
1818
- manila
19-
- role: install-k3s
20-
worker_node_count: 0
2119
- role: install-docker
2220
- role: install-docker-registry
2321
cert_hosts: ' ["{{ ansible_default_ipv4.address }}"]'
22+
- role: install-k3s
23+
worker_node_count: 0
2424
- role: install-cpo-occm
2525
run_e2e: false
2626
- role: install-helm

tests/playbooks/test-occm-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
- octavia
2121
- ovn-octavia
2222
- barbican
23-
- role: install-k3s
24-
worker_node_count: 0
2523
- role: install-docker
2624
- role: install-docker-registry
2725
cert_hosts: ' ["{{ ansible_default_ipv4.address }}"]'
26+
- role: install-k3s
27+
worker_node_count: 0
2828
- role: install-cpo-occm
2929
run_e2e: "{{ run_e2e }}"
3030
octavia_provider: "{{ octavia_provider }}"

0 commit comments

Comments
 (0)