mirror of
https://github.com/labring/sealos.git
synced 2026-10-24 11:53:32 +08:00
57 lines
2.8 KiB
Go
57 lines
2.8 KiB
Go
// Copyright © 2019 NAME HERE <EMAIL ADDRESS>
|
|
//
|
|
// 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 cmd
|
|
|
|
import (
|
|
"github.com/fanux/sealos/install"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// initCmd represents the init command
|
|
var initCmd = &cobra.Command{
|
|
Use: "init",
|
|
Short: "Simplest way to init your kubernets HA cluster",
|
|
Long: `sealos init --master 192.168.0.2 --master 192.168.0.3 --master 192.168.0.4 --node 192.168.0.5 --user root --passwd your-server-password`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
install.BuildInit()
|
|
c := &install.SealConfig{}
|
|
c.Dump("")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(initCmd)
|
|
|
|
// Here you will define your flags and configuration settings.
|
|
initCmd.Flags().StringVar(&install.User, "user", "root", "servers user name for ssh")
|
|
initCmd.Flags().StringVar(&install.Passwd, "passwd", "", "password for ssh")
|
|
initCmd.Flags().StringVar(&install.PrivateKeyFile, "pk", "/root/.ssh/id_rsa", "private key for ssh")
|
|
|
|
initCmd.Flags().StringVar(&install.KubeadmFile, "kubeadm-config", "", "kubeadm-config.yaml template file")
|
|
|
|
initCmd.Flags().StringVar(&install.ApiServer, "apiserver", "apiserver.cluster.local", "apiserver domain name")
|
|
initCmd.Flags().StringVar(&install.VIP, "vip", "10.103.97.2", "virtual ip")
|
|
initCmd.Flags().StringSliceVar(&install.MasterIPs, "master", []string{}, "kubernetes multi-masters ex. 192.168.0.2-192.168.0.4")
|
|
initCmd.Flags().StringSliceVar(&install.NodeIPs, "node", []string{}, "kubernetes multi-nodes ex. 192.168.0.5-192.168.0.5")
|
|
initCmd.Flags().StringVar(&install.PkgUrl, "pkg-url", "", "http://store.lameleg.com/kube1.14.1.tar.gz download offline package url, or file localtion ex. /root/kube1.14.1.tar.gz")
|
|
initCmd.Flags().StringVar(&install.Version, "version", "v1.14.1", "version is kubernetes version")
|
|
initCmd.Flags().StringVar(&install.Repo, "repo", "k8s.gcr.io", "choose a container registry to pull control plane images from")
|
|
initCmd.Flags().StringVar(&install.PodCIDR, "podcidr", "100.64.0.0/10", "Specify range of IP addresses for the pod network")
|
|
initCmd.Flags().StringVar(&install.SvcCIDR, "svccidr", "10.96.0.0/12", "Use alternative range of IP address for service VIPs")
|
|
|
|
initCmd.Flags().BoolVar(&install.WithoutCNI, "without-cni", false, "If true we not install cni plugin")
|
|
initCmd.Flags().StringVar(&install.Network, "network", "calico", "cni plugin, calico..")
|
|
}
|