I am working on an ansible based dev-bootstrap project. I'd like to be able to enable the kubernetes from the docker role, but i cant seem to find a way to do so. I searched the registry for docker
and kubernetes
, nothing jumped out. I also checked for a daemon.json, but none is present even though i have kubernetes enabled (manually). Does anyone know if there is a way to make this happen?
Not sure if this is all you need, but when toggling the enable Kubernetes option it writes to the settings.json. There is also a Kubernetes Initial install step, so this might not be enough, but I would try see if it picks it up, needs a restart or doesn't work at all...
function Enable-DockerKubernetes {
[CmdletBinding()]
param ()
try {
$settings = "$env:AppData\Docker\settings.json"
$dockerSettings = ConvertFrom-Json ( Get-Content $settings -Raw -ErrorAction Stop)
if (!$dockerSettings.KubernetesEnabled) {
Write-Verbose ("Enabling Kubernetes in {0}." -f $settings)
$dockerSettings.KubernetesEnabled = $true
$dockerSettings | ConvertTo-Json | Set-Content $settings -ErrorAction Stop
}
else {
Write-Verbose "Already enabled!"
}
}
catch {
Write-Error $_
}
}
The installer for Docker CE doesn't seem to support passing in installer options according to this issue which just went stale and got closed.
You might want to open a new issue specifically about this use case.