-
Notifications
You must be signed in to change notification settings - Fork 558
kata: introduce kata container support #3465
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"apiVersion": "vlabs", | ||
"properties": { | ||
"orchestratorProfile": { | ||
"orchestratorType": "Kubernetes", | ||
"orchestratorRelease": "1.10", | ||
"kubernetesConfig": { | ||
"networkPlugin": "flannel", | ||
"containerRuntime": "kata-containers" | ||
} | ||
}, | ||
"masterProfile": { | ||
"count": 1, | ||
"dnsPrefix": "", | ||
"vmSize": "Standard_D2_v2" | ||
}, | ||
"agentPoolProfiles": [ | ||
{ | ||
"name": "agentpool1", | ||
"count": 3, | ||
"vmSize": "Standard_D4s_v3", | ||
"availabilityProfile": "AvailabilitySet" | ||
} | ||
], | ||
"linuxProfile": { | ||
"adminUsername": "azureuser", | ||
"ssh": { | ||
"publicKeys": [ | ||
{ | ||
"keyData": "" | ||
} | ||
] | ||
} | ||
}, | ||
"servicePrincipalProfile": { | ||
"clientId": "", | ||
"secret": "" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ ERR_CNI_DOWNLOAD_TIMEOUT=41 # Timeout waiting for CNI download(s) | |
ERR_MS_PROD_DEB_DOWNLOAD_TIMEOUT=42 # Timeout waiting for https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb | ||
ERR_MS_PROD_DEB_PKG_ADD_FAIL=43 # Failed to add repo pkg file | ||
ERR_OUTBOUND_CONN_FAIL=50 # Unable to establish outbound connection | ||
ERR_KATA_KEY_DOWNLOAD_TIMEOUT=60 # Timeout waiting to download kata repo key | ||
ERR_KATA_APT_KEY_TIMEOUT=61 # Timeout waiting for kata apt-key | ||
ERR_KATA_INSTALL_TIMEOUT=62 # Timeout waiting for kata install | ||
ERR_CUSTOM_SEARCH_DOMAINS_FAIL=80 # Unable to configure custom search domains | ||
ERR_APT_DAILY_TIMEOUT=98 # Timeout waiting for apt daily updates | ||
ERR_APT_UPDATE_TIMEOUT=99 # Timeout waiting for apt-get update to complete | ||
|
@@ -281,6 +284,24 @@ function configNetworkPlugin() { | |
fi | ||
} | ||
|
||
function installKataContainersRuntime() { | ||
# Add Kata Containers repository key | ||
echo "Adding Kata Containers repository key..." | ||
KATA_RELEASE_KEY_TMP=/tmp/kata-containers-release.key | ||
KATA_URL=http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_16.04/Release.key | ||
retrycmd_if_failure_no_stats 20 1 5 curl -fsSL $KATA_URL > $KATA_RELEASE_KEY_TMP || exit $ERR_KATA_KEY_DOWNLOAD_TIMEOUT | ||
retrycmd_if_failure 10 5 10 apt-key add $KATA_RELEASE_KEY_TMP || exit $ERR_KATA_APT_KEY_TIMEOUT | ||
|
||
# Add Kata Container repository | ||
echo "Adding Kata Containers repository..." | ||
echo 'deb http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/kata-containers.list | ||
|
||
# Install Kata Containers runtime | ||
echo "Installing Kata Containers runtime..." | ||
apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT | ||
apt_get_install 20 30 120 kata-runtime || exit $ERR_KATA_INSTALL_TIMEOUT | ||
} | ||
|
||
function installClearContainersRuntime() { | ||
# Add Clear Containers repository key | ||
echo "Adding Clear Containers repository key..." | ||
|
@@ -323,6 +344,8 @@ function setupContainerd() { | |
echo "runtime_type = 'io.containerd.runtime.v1.linux'" >> "$CRI_CONTAINERD_CONFIG" | ||
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]]; then | ||
echo "runtime_engine = '/usr/bin/cc-runtime'" >> "$CRI_CONTAINERD_CONFIG" | ||
elif [[ "$CONTAINER_RUNTIME" == "kata-containers" ]]; then | ||
echo "runtime_engine = '/usr/bin/kata-runtime'" >> "$CRI_CONTAINERD_CONFIG" | ||
else | ||
echo "runtime_engine = '/usr/local/sbin/runc'" >> "$CRI_CONTAINERD_CONFIG" | ||
fi | ||
|
@@ -344,13 +367,13 @@ function installContainerd() { | |
sed -i '/\[Service\]/a ExecStartPost=\/sbin\/iptables -P FORWARD ACCEPT' /etc/systemd/system/containerd.service | ||
|
||
echo "Successfully installed cri-containerd..." | ||
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]] || [[ "$CONTAINER_RUNTIME" == "containerd" ]]; then | ||
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]] || [[ "$CONTAINER_RUNTIME" == "kata-containers" ]] || [[ "$CONTAINER_RUNTIME" == "containerd" ]]; then | ||
setupContainerd | ||
fi | ||
} | ||
|
||
function ensureContainerd() { | ||
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]] || [[ "$CONTAINER_RUNTIME" == "containerd" ]]; then | ||
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]] || [[ "$CONTAINER_RUNTIME" == "kata-containers" ]] || [[ "$CONTAINER_RUNTIME" == "containerd" ]]; then | ||
# Enable and start cri-containerd service | ||
# Make sure this is done after networking plugins are installed | ||
echo "Enabling and starting cri-containerd service..." | ||
|
@@ -546,6 +569,14 @@ if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]]; then | |
installClearContainersRuntime | ||
fi | ||
fi | ||
|
||
if [[ "$CONTAINER_RUNTIME" == "kata-containers" ]]; then | ||
# Ensure we can nest virtualization | ||
if grep -q vmx /proc/cpuinfo; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if this is false? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in that case, the given node would not install kata container artifacts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would the node be functional? Does that mean there would be no container runtime installed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'll be fully functional, though the user may hope to use Kata, but in reality be using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, thanks for clarifying |
||
installKataContainersRuntime | ||
fi | ||
fi | ||
|
||
echo `date`,`hostname`, ensureContainerdStart>>/opt/m | ||
ensureContainerd | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1083,6 +1083,18 @@ func Test_Properties_ValidateContainerRuntime(t *testing.T) { | |
) | ||
} | ||
|
||
p.OrchestratorProfile.KubernetesConfig.ContainerRuntime = "kata-containers" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is kata-containers supported for all k8s versions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kata is more tightly couple with the CRI-shim version (in this case, containerd). I think if there's an error, it'll likely be a mismatch between containerd + k8s? |
||
p.AgentPoolProfiles = []*AgentPoolProfile{ | ||
{ | ||
OSType: Windows, | ||
}, | ||
} | ||
if err := p.validateContainerRuntime(); err == nil { | ||
t.Errorf( | ||
"should error on kata-containers for windows clusters", | ||
) | ||
} | ||
|
||
p.OrchestratorProfile.KubernetesConfig.ContainerRuntime = "containerd" | ||
p.AgentPoolProfiles = []*AgentPoolProfile{ | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that my comments in this function also apply to
installClearContainersRuntime()
, which is probably why you did it that way but I thinkinstallClearContainersRuntime
needs to be changed as well to have proper exit codes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Okay to update the example function,
installClearContainersRuntime()
, in a follow-on PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course!