AliyunContainerService / minikube

ๆ™ฎๅคงๅ–œๅฅ”๏ผŒๅฎ˜ๆ–นMinikubeๆไพ›ไบ†ๅฎŒๆ•ดๅฏนๅ›ฝๅ†…็”จๆˆทๆ”ฏๆŒ๏ผŒๅฎŒ็พŽๆ”ฏๆŒAddon็ป„ไปถใ€‚ ๅปบ่ฎฎๅ‚่€ƒ https://yq.aliyun.com/articles/221687 ๆˆ– https://github.com/AliyunContainerService/minikube/wiki ๆœ€ๆ–ฐๆ”ฏๆŒminikube v1.24.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error unmarshaling configuration schema.GroupVersionKind{Group:"kubeadm.k8s.io", Version:"v1alpha3", Kind:"InitConfiguration"}

jk2K opened this issue ยท comments

start cluster, got below errors

minikube start --vm-driver=hyperkit --registry-mirror=https://registry.docker-cn.com
๐Ÿ˜„  minikube v0.35.0 on darwin (amd64)
๐Ÿ’ก  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
๐Ÿƒ  Re-using the currently running hyperkit VM for "minikube" ...
โŒ›  Waiting for SSH access ...
๐Ÿ“ถ  "minikube" IP address is 192.168.64.2
๐Ÿณ  Configuring Docker as the container runtime ...
โœจ  Preparing Kubernetes environment ...
๐Ÿšœ  Pulling images required by Kubernetes v1.13.4 ...
โŒ  Unable to pull images, which may be OK: running cmd: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml: command failed: sudo kubeadm config images pull --config /var/lib/kubeadm.yaml
stdout:
stderr: W0313 11:35:37.149909    9133 strict.go:54] error unmarshaling configuration schema.GroupVersionKind{Group:"kubeadm.k8s.io", Version:"v1alpha3", Kind:"InitConfiguration"}: error unmarshaling JSON: while decoding JSON: json: unknown field "imageRepository"
failed to pull image "registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.13.4": output: Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: dial tcp: lookup registry.cn-hangzhou.aliyuncs.com on 192.168.64.1:53: read udp 192.168.64.2:36381->192.168.64.1:53: read: connection refused
, error: exit status 1
: Process exited with status 1
๐Ÿ”„  Relaunching Kubernetes v1.13.4 using kubeadm ...
โŒ›  Waiting for pods: apiserver^C

imageRepository is in wrong place, InitConfiguration should not have imageRepository

/*
Copyright 2016 The Kubernetes Authors All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package kubeadm

import (
	"fmt"
	"sort"
	"text/template"
)

var kubeadmConfigTemplateV1Alpha1 = template.Must(template.New("kubeadmConfigTemplate-v1alpha1").Funcs(template.FuncMap{
	"printMapInOrder": printMapInOrder,
}).Parse(`apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
{{if .NoTaintMaster}}noTaintMaster: true{{end}}
api:
  advertiseAddress: {{.AdvertiseAddress}}
  bindPort: {{.APIServerPort}}
  controlPlaneEndpoint: localhost
kubernetesVersion: {{.KubernetesVersion}}
imageRepository: "registry.cn-hangzhou.aliyuncs.com/google_containers"
certificatesDir: {{.CertDir}}
networking:
  serviceSubnet: {{.ServiceCIDR}}
etcd:
  dataDir: {{.EtcdDataDir}}
nodeName: {{.NodeName}}
{{if .CRISocket}}criSocket: {{.CRISocket}}
{{end}}{{range .ExtraArgs}}{{.Component}}:{{range $i, $val := printMapInOrder .Options ": " }}
  {{$val}}{{end}}
{{end}}{{if .FeatureArgs}}featureGates: {{range $i, $val := .FeatureArgs}}
  {{$i}}: {{$val}}{{end}}
{{end}}`))

var kubeadmConfigTemplateV1Alpha3 = template.Must(template.New("kubeadmConfigTemplate-v1alpha3").Funcs(template.FuncMap{
	"printMapInOrder": printMapInOrder,
}).Parse(`
apiVersion: kubeadm.k8s.io/v1alpha3
kind: InitConfiguration
apiEndpoint:
  advertiseAddress: {{.AdvertiseAddress}}
  bindPort: {{.APIServerPort}}
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
nodeRegistration:
  criSocket: {{if .CRISocket}}{{.CRISocket}}{{else}}/var/run/dockershim.sock{{end}}
  name: {{.NodeName}}
  taints: []
---
apiVersion: kubeadm.k8s.io/v1alpha3
kind: ClusterConfiguration
{{range .ExtraArgs}}{{.Component}}:{{range $i, $val := printMapInOrder .Options ": " }}
  {{$val}}{{end}}
{{end}}{{if .FeatureArgs}}featureGates: {{range $i, $val := .FeatureArgs}}
  {{$i}}: {{$val}}{{end}}
{{end}}
certificatesDir: {{.CertDir}}
clusterName: kubernetes
controlPlaneEndpoint: localhost:{{.APIServerPort}}
etcd:
  local:
    dataDir: {{.EtcdDataDir}}
kubernetesVersion: {{.KubernetesVersion}}
imageRepository: "registry.cn-hangzhou.aliyuncs.com/google_containers"
networking:
  dnsDomain: cluster.local
  podSubnet: ""
  serviceSubnet: {{.ServiceCIDR}}
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
# disable disk resource management by default, as it doesn't work well within the minikube environment.
imageGCHighThresholdPercent: 100
# Don't evict jobs, as we only have a single node to run on.
evictionHard:
  nodefs.available: "0%"
  nodefs.inodesFree: "0%"
  imagefs.available: "0%"
  `))

var kubeletSystemdTemplate = template.Must(template.New("kubeletSystemdTemplate").Parse(`
[Unit]
{{if or (eq .ContainerRuntime "cri-o") (eq .ContainerRuntime "cri")}}Wants=crio.service{{else}}Wants=docker.socket{{end}}

[Service]
ExecStart=
ExecStart=/usr/bin/kubelet {{.ExtraOptions}} {{if .FeatureGates}}--feature-gates={{.FeatureGates}}{{end}}

[Install]
`))

const kubeletService = `
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=http://kubernetes.io/docs/

[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target
`

var kubeadmInitTemplate = template.Must(template.New("kubeadmInitTemplate").Parse(loadImageScripts() + `
sudo /usr/bin/kubeadm init --config {{.KubeadmConfigFile}} {{if .SkipPreflightChecks}}--skip-preflight-checks{{else}}{{range .Preflights}}--ignore-preflight-errors={{.}} {{end}}{{end}}
`))

// printMapInOrder sorts the keys and prints the map in order, combining key
// value pairs with the separator character
//
// Note: this is not necessary, but makes testing easy
func printMapInOrder(m map[string]string, sep string) []string {
	if m == nil {
		return nil
	}
	keys := []string{}
	for k := range m {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for i, k := range keys {
		keys[i] = fmt.Sprintf("%s%s\"%s\"", k, sep, m[k])
	}
	return keys
}
commented

ๆˆ‘่ฟ™่พนๆ˜ฏๅฏไปฅ็š„

$ minikube start --registry-mirror=https://registry.docker-cn.com
๐Ÿ˜„  minikube v0.35.0 on darwin (amd64)
๐Ÿ”ฅ  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
๐Ÿ’ฟ  Downloading Minikube ISO ...
 184.42 MB / 184.42 MB [============================================] 100.00% 0s
๐Ÿ“ถ  "minikube" IP address is 192.168.99.100
๐Ÿณ  Configuring Docker as the container runtime ...
โœจ  Preparing Kubernetes environment ...
๐Ÿ’พ  Downloading kubeadm v1.13.4
๐Ÿ’พ  Downloading kubelet v1.13.4
๐Ÿšœ  Pulling images required by Kubernetes v1.13.4 ...
๐Ÿš€  Launching Kubernetes v1.13.4 using kubeadm ... 
โŒ›  Waiting for pods: apiserver proxy etcd scheduler controller addon-manager dns
๐Ÿ”‘  Configuring cluster permissions ...
๐Ÿค”  Verifying component health .....
๐Ÿ’—  kubectl is now configured to use "minikube"
๐Ÿ„  Done! Thank you for using minikube!
$ minikube dashboard
๐Ÿ”Œ  Enabling dashboard ...
๐Ÿค”  Verifying dashboard health ...
๐Ÿš€  Launching proxy ...
๐Ÿค”  Verifying proxy health 
commented

่ฏท้‡ๆ–ฐ้ชŒ่ฏ๏ผŒๅคš่ฐข