Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
72f69546
Unverified
Commit
72f69546
authored
May 17, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77889 from Random-Liu/support-using-containerd-in-cos
Support using docker containerd in COS and Ubuntu on GCE.
parents
21448ea6
bc1a78d3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
7 deletions
+93
-7
config-default.sh
cluster/gce/config-default.sh
+11
-3
config-test.sh
cluster/gce/config-test.sh
+9
-1
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+71
-1
util.sh
cluster/gce/util.sh
+2
-2
No files found.
cluster/gce/config-default.sh
View file @
72f69546
...
...
@@ -79,22 +79,30 @@ fi
# you are updating the os image versions, update this variable.
# Also please update corresponding image for node e2e at:
# https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/jenkins/image-config.yaml
GCI_VERSION
=
${
KUBE_GCI_VERSION
:-
cos
-
beta-73-11647-64
-0
}
GCI_VERSION
=
${
KUBE_GCI_VERSION
:-
cos
-
73-11647-163
-0
}
MASTER_IMAGE
=
${
KUBE_GCE_MASTER_IMAGE
:-}
MASTER_IMAGE_PROJECT
=
${
KUBE_GCE_MASTER_PROJECT
:-
cos
-cloud
}
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
GCI_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
cos
-cloud
}
NODE_SERVICE_ACCOUNT
=
${
KUBE_GCE_NODE_SERVICE_ACCOUNT
:-
default
}
# KUBELET_TEST_ARGS are extra arguments passed to kubelet.
KUBELET_TEST_ARGS
=
${
KUBE_KUBELET_EXTRA_ARGS
:-}
CONTAINER_RUNTIME
=
${
KUBE_CONTAINER_RUNTIME
:-
docker
}
CONTAINER_RUNTIME_ENDPOINT
=
${
KUBE_CONTAINER_RUNTIME_ENDPOINT
:-}
CONTAINER_RUNTIME_NAME
=
${
KUBE_CONTAINER_RUNTIME_NAME
:-}
LOAD_IMAGE_COMMAND
=
${
KUBE_LOAD_IMAGE_COMMAND
:-}
if
[[
"
${
CONTAINER_RUNTIME
}
"
==
"containerd"
]]
;
then
CONTAINER_RUNTIME_NAME
=
${
KUBE_CONTAINER_RUNTIME_NAME
:-
containerd
}
CONTAINER_RUNTIME_ENDPOINT
=
${
KUBE_CONTAINER_RUNTIME_ENDPOINT
:-
unix
:///run/containerd/containerd.sock
}
LOAD_IMAGE_COMMAND
=
${
KUBE_LOAD_IMAGE_COMMAND
:-
ctr
-n=k8s.io images import
}
KUBELET_TEST_ARGS
=
"
${
KUBELET_TEST_ARGS
}
--runtime-cgroups=/system.slice/containerd.service"
fi
# MASTER_EXTRA_METADATA is the extra instance metadata on master instance separated by commas.
MASTER_EXTRA_METADATA
=
${
KUBE_MASTER_EXTRA_METADATA
:-${
KUBE_EXTRA_METADATA
:-}}
# MASTER_EXTRA_METADATA is the extra instance metadata on node instance separated by commas.
NODE_EXTRA_METADATA
=
${
KUBE_NODE_EXTRA_METADATA
:-${
KUBE_EXTRA_METADATA
:-}}
# KUBELET_TEST_ARGS are extra arguments passed to kubelet.
KUBELET_TEST_ARGS
=
${
KUBE_KUBELET_EXTRA_ARGS
:-}
NETWORK
=
${
KUBE_GCE_NETWORK
:-
default
}
# Enable network deletion by default (for kube-down), unless we're using 'default' network.
...
...
cluster/gce/config-test.sh
View file @
72f69546
...
...
@@ -86,17 +86,25 @@ ALLOWED_NOTREADY_NODES="${ALLOWED_NOTREADY_NODES:-$(($(get-num-nodes) / 100))}"
# you are updating the os image versions, update this variable.
# Also please update corresponding image for node e2e at:
# https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/jenkins/image-config.yaml
GCI_VERSION
=
${
KUBE_GCI_VERSION
:-
cos
-
beta-73-11647-64
-0
}
GCI_VERSION
=
${
KUBE_GCI_VERSION
:-
cos
-
73-11647-163
-0
}
MASTER_IMAGE
=
${
KUBE_GCE_MASTER_IMAGE
:-}
MASTER_IMAGE_PROJECT
=
${
KUBE_GCE_MASTER_PROJECT
:-
cos
-cloud
}
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
GCI_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
cos
-cloud
}
NODE_SERVICE_ACCOUNT
=
${
KUBE_GCE_NODE_SERVICE_ACCOUNT
:-
default
}
CONTAINER_RUNTIME
=
${
KUBE_CONTAINER_RUNTIME
:-
docker
}
CONTAINER_RUNTIME_ENDPOINT
=
${
KUBE_CONTAINER_RUNTIME_ENDPOINT
:-}
CONTAINER_RUNTIME_NAME
=
${
KUBE_CONTAINER_RUNTIME_NAME
:-}
LOAD_IMAGE_COMMAND
=
${
KUBE_LOAD_IMAGE_COMMAND
:-}
GCI_DOCKER_VERSION
=
${
KUBE_GCI_DOCKER_VERSION
:-}
if
[[
"
${
CONTAINER_RUNTIME
}
"
==
"containerd"
]]
;
then
CONTAINER_RUNTIME_NAME
=
${
KUBE_CONTAINER_RUNTIME_NAME
:-
containerd
}
CONTAINER_RUNTIME_ENDPOINT
=
${
KUBE_CONTAINER_RUNTIME_ENDPOINT
:-
unix
:///run/containerd/containerd.sock
}
LOAD_IMAGE_COMMAND
=
${
KUBE_LOAD_IMAGE_COMMAND
:-
ctr
-n=k8s.io images import
}
KUBELET_TEST_ARGS
=
"
${
KUBELET_TEST_ARGS
:-}
--runtime-cgroups=/system.slice/containerd.service"
fi
# MASTER_EXTRA_METADATA is the extra instance metadata on master instance separated by commas.
MASTER_EXTRA_METADATA
=
${
KUBE_MASTER_EXTRA_METADATA
:-${
KUBE_EXTRA_METADATA
:-}}
# MASTER_EXTRA_METADATA is the extra instance metadata on node instance separated by commas.
...
...
cluster/gce/gci/configure-helper.sh
View file @
72f69546
...
...
@@ -2854,6 +2854,73 @@ function ensure-bootstrap-kubectl-auth {
fi
}
function
setup-containerd
{
echo
"Generate containerd config"
local
config_path
=
"
${
CONTAINERD_CONFIG_PATH
:-
"/etc/containerd/config.toml"
}
"
mkdir
-p
"
$(
dirname
"
${
config_path
}
"
)
"
local
cni_template_path
=
"
${
KUBE_HOME
}
/cni.template"
cat
>
"
${
cni_template_path
}
"
<<
EOF
{
"name": "k8s-pod-network",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "ptp",
"mtu": 1460,
"ipam": {
"type": "host-local",
"subnet": "{{.PodCIDR}}",
"routes": [
{
"dst": "0.0.0.0/0"
}
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}
EOF
if
[[
"
${
KUBERNETES_MASTER
:-}
"
!=
"true"
]]
;
then
if
[[
"
${
NETWORK_POLICY_PROVIDER
:-
"none"
}
"
!=
"none"
||
"
${
ENABLE_NETD
:-}
"
==
"true"
]]
;
then
# Use Kubernetes cni daemonset on node if network policy provider is specified
# or netd is enabled.
cni_template_path
=
""
fi
fi
# Reuse docker group for containerd.
local
containerd_gid
=
"
$(
cat
/etc/group |
grep
^docker: |
cut
-d
:
-f
3
)
"
cat
>
"
${
config_path
}
"
<<
EOF
# Kubernetes doesn't use containerd restart manager.
disabled_plugins = ["restart"]
[debug]
level = "
${
CONTAINERD_LOG_LEVEL
:-
"info"
}
"
[grpc]
gid =
${
containerd_gid
}
[plugins.cri]
stream_server_address = "127.0.0.1"
max_container_log_line_size =
${
CONTAINERD_MAX_CONTAINER_LOG_LINE
:-
262144
}
[plugins.cri.cni]
bin_dir = "
${
KUBE_HOME
}
/bin"
conf_dir = "/etc/cni/net.d"
conf_template = "
${
cni_template_path
}
"
[plugins.cri.registry.mirrors."docker.io"]
endpoint = ["https://mirror.gcr.io","https://registry-1.docker.io"]
EOF
chmod
644
"
${
config_path
}
"
echo
"Restart containerd to load the config change"
systemctl restart containerd
}
########### Main Function ###########
function
main
()
{
echo
"Start to configure instance for kubernetes"
...
...
@@ -2941,9 +3008,12 @@ function main() {
fi
override-kubectl
container_runtime
=
"
${
CONTAINER_RUNTIME
:-
docker
}
"
# Run the containerized mounter once to pre-cache the container image.
if
[[
"
${
CONTAINER_RUNTIME
:-
docker
}
"
==
"docker"
]]
;
then
if
[[
"
${
container_runtime
}
"
==
"docker"
]]
;
then
assemble-docker-flags
elif
[[
"
${
container_runtime
}
"
==
"containerd"
]]
;
then
setup-containerd
fi
start-kubelet
...
...
cluster/gce/util.sh
View file @
72f69546
...
...
@@ -782,8 +782,8 @@ function construct-linux-kubelet-flags {
if
[[
-n
"
${
NODE_TAINTS
:-}
"
]]
;
then
flags+
=
" --register-with-taints=
${
NODE_TAINTS
}
"
fi
if
[[
-n
"
${
CONTAINER_RUNTIME
:-}
"
]]
;
then
flags+
=
" --container-runtime=
${
CONTAINER_RUNTIME
}
"
if
[[
"
${
CONTAINER_RUNTIME
:-}
"
!=
"docker
"
]]
;
then
flags+
=
" --container-runtime=
remote
"
fi
if
[[
-n
"
${
CONTAINER_RUNTIME_ENDPOINT
:-}
"
]]
;
then
flags+
=
" --container-runtime-endpoint=
${
CONTAINER_RUNTIME_ENDPOINT
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment