mirror of https://github.com/kubernetes/kops.git
parent
e648669852
commit
5c92bc6a2d
|
@ -34,6 +34,7 @@ import (
|
|||
"k8s.io/kops/pkg/apis/kops/registry"
|
||||
"k8s.io/kops/pkg/apis/kops/validation"
|
||||
"k8s.io/kops/pkg/client/simple/vfsclientset"
|
||||
"k8s.io/kops/pkg/featureflag"
|
||||
"k8s.io/kops/upup/pkg/fi"
|
||||
"k8s.io/kops/upup/pkg/fi/cloudup"
|
||||
"k8s.io/kops/upup/pkg/fi/utils"
|
||||
|
@ -214,12 +215,14 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
cmd.Flags().StringVar(&options.MasterTenancy, "master-tenancy", options.MasterTenancy, "The tenancy of the master group on AWS. Can either be default or dedicated.")
|
||||
cmd.Flags().StringVar(&options.NodeTenancy, "node-tenancy", options.NodeTenancy, "The tenancy of the node group on AWS. Can be either default or dedicated.")
|
||||
|
||||
// vSphere flags
|
||||
cmd.Flags().StringVar(&options.VSphereServer, "vsphere-server", options.VSphereServer, "vsphere-server is required for vSphere. Set vCenter URL Ex: 10.192.10.30 or myvcenter.io (without https://)")
|
||||
cmd.Flags().StringVar(&options.VSphereDatacenter, "vsphere-datacenter", options.VSphereDatacenter, "vsphere-datacenter is required for vSphere. Set the name of the datacenter in which to deploy Kubernetes VMs.")
|
||||
cmd.Flags().StringVar(&options.VSphereResourcePool, "vsphere-resource-pool", options.VSphereDatacenter, "vsphere-resource-pool is required for vSphere. Set a valid Cluster, Host or Resource Pool in which to deploy Kubernetes VMs.")
|
||||
cmd.Flags().StringVar(&options.VSphereCoreDNSServer, "vsphere-coredns-server", options.VSphereCoreDNSServer, "vsphere-coredns-server is required for vSphere.")
|
||||
cmd.Flags().StringVar(&options.VSphereDatastore, "vsphere-datastore", options.VSphereDatastore, "vsphere-datastore is required for vSphere. Set a valid datastore in which to store dynamic provision volumes.")
|
||||
if featureflag.VSphereCloudProvider.Enabled() {
|
||||
// vSphere flags
|
||||
cmd.Flags().StringVar(&options.VSphereServer, "vsphere-server", options.VSphereServer, "vsphere-server is required for vSphere. Set vCenter URL Ex: 10.192.10.30 or myvcenter.io (without https://)")
|
||||
cmd.Flags().StringVar(&options.VSphereDatacenter, "vsphere-datacenter", options.VSphereDatacenter, "vsphere-datacenter is required for vSphere. Set the name of the datacenter in which to deploy Kubernetes VMs.")
|
||||
cmd.Flags().StringVar(&options.VSphereResourcePool, "vsphere-resource-pool", options.VSphereDatacenter, "vsphere-resource-pool is required for vSphere. Set a valid Cluster, Host or Resource Pool in which to deploy Kubernetes VMs.")
|
||||
cmd.Flags().StringVar(&options.VSphereCoreDNSServer, "vsphere-coredns-server", options.VSphereCoreDNSServer, "vsphere-coredns-server is required for vSphere.")
|
||||
cmd.Flags().StringVar(&options.VSphereDatastore, "vsphere-datastore", options.VSphereDatastore, "vsphere-datastore is required for vSphere. Set a valid datastore in which to store dynamic provision volumes.")
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -538,6 +541,10 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
cluster.Spec.CloudProvider = c.Cloud
|
||||
|
||||
if c.Cloud == "vsphere" {
|
||||
if !featureflag.VSphereCloudProvider.Enabled() {
|
||||
return fmt.Errorf("Feature flag VSphereCloudProvider is not set. Cloud vSphere will not be supported.")
|
||||
}
|
||||
|
||||
if cluster.Spec.CloudConfig == nil {
|
||||
cluster.Spec.CloudConfig = &api.CloudConfiguration{}
|
||||
}
|
||||
|
|
|
@ -85,25 +85,30 @@ source [kops_dir]/hack/vsphere/set_env
|
|||
make vsphere-version-dist
|
||||
```
|
||||
|
||||
Currently vSphere support is not part of any of the kops releases. Hence, all modified component- kops, nodeup, protokube, need building at least once. ```make vsphere-version-dist``` will do that and copy protokube image and nodeup binary at the target location specified by you in ```vsphere-env.sh```. Dns-controller has also been modified to support vSphere. You can continue to use ```export VSPHERE_DNSCONTROLLER_IMAGE=luomiao/dns-controller```, unless you are making some changes to dns-controller and would like to use your custom image.
|
||||
Currently vSphere support is not part of any of the kops releases. Hence, all modified component- kops, nodeup, protokube, need building at least once. ```make vsphere-version-dist``` will do that and copy protokube image and nodeup binary at the target location specified by you in ```[kops_dir]/hack/vsphere/set_env```.
|
||||
|
||||
Please note that dns-controller has also been modified to support vSphere. You can continue to use ```export VSPHERE_DNSCONTROLLER_IMAGE=luomiao/dns-controller```. If you have made any local changes to dns-controller and would like to use your custom image you need to build the dns-controller image using ```DOCKER_REGISTRY=[your docker hub repo] make dns-controller-push``` and set ```VSPHERE_DNSCONTROLLER_IMAGE``` accordingly. Please see the relevant Section above, on setting up DNS.
|
||||
|
||||
### Launching Cluster
|
||||
Execute following command to launch cluster.
|
||||
|
||||
```bash
|
||||
kops create cluster kubernetes.skydns.local --cloud=vsphere --zones=us-east-a --dns-zone=skydns.local --networking=flannel
|
||||
.build/dist/darwin/amd64/kops create cluster kubernetes.skydns.local --cloud=vsphere --zones=${AWS_REGION}a --dns-zone=skydns.local --networking=flannel
|
||||
--vsphere-server=10.160.97.44 --vsphere-datacenter=VSAN-DC --vsphere-resource-pool=VSAN-Cluster --vsphere-datastore=vsanDatastore --dns private --vsphere-coredns-server=http://10.192.217.24:2379 --image="ubuntu_16_04"
|
||||
```
|
||||
|
||||
Use .build/dist/linux/amd64/kops if working on a linux machine, instead of mac.
|
||||
|
||||
**Notes**
|
||||
1. clustername should end with **skydns.local**. Example: ```kubernetes.cluster.skydns.local```.
|
||||
2. zones should end with ```a```. Example: ```us-west-a```.
|
||||
|
||||
1. ```clustername``` should end with **skydns.local**. Example: ```kubernetes.cluster.skydns.local```.
|
||||
2. ```zones``` should end with ```a```. Example: ```us-west-2a``` or as the above command sets ```--zones=${AWS_REGION}a```.
|
||||
3. Make sure following parameters have these values,
|
||||
* ```--dns-zone=skydns.local```
|
||||
* ```--networking=flannel```
|
||||
* ```--dns=private```
|
||||
|
||||
#### Cleaning up environment
|
||||
### Cleaning up environment
|
||||
Run following command to cleanup all set environment variables and regenerate all images and binaries without any of the vSphere specific steps.
|
||||
|
||||
```bash
|
||||
|
@ -111,15 +116,6 @@ source [kops_dir]/hack/vsphere/cleanup_env
|
|||
make version-dist
|
||||
```
|
||||
|
||||
### Creating cluster
|
||||
Execute following command(s) to create a kubernetes cluster on vSphere using kops-
|
||||
|
||||
```bash
|
||||
.build/dist/darwin/amd64/kops create cluster --cloud=vsphere --name=yourcluster.skydns.local --zones=us-west-2a --vsphere-server=<vsphere-server-ip> --vsphere-datacenter=<datacenter-name> --vsphere-resource-pool=<cluster-name> --vsphere-datastore=<datastore-name> --dns=private --vsphere-coredns-server=http://<dns-server-ip>:2379 --dns-zone=skydns.local --image=<template-vm-name> --yes
|
||||
```
|
||||
|
||||
User .build/dist/linux/amd64/kops if working on a linux machine, instead of mac.
|
||||
|
||||
### Deleting cluster
|
||||
Cluster deletion hasn't been fully implemented yet. So you will have to delete vSphere VM's manually for now.
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
export KOPS_FEATURE_FLAGS=
|
||||
export VSPHERE_DNS=
|
||||
export VSPHERE_DNSCONTROLLER_IMAGE=
|
||||
export KOPS_STATE_STORE=
|
||||
|
@ -27,6 +28,7 @@ export TARGET_PATH=
|
|||
export NODEUP_URL=
|
||||
export PROTOKUBE_IMAGE=
|
||||
|
||||
echo "KOPS_FEATURE_FLAGS=${KOPS_FEATURE_FLAGS}"
|
||||
echo "VSPHERE_DNS=${VSPHERE_DNS}"
|
||||
echo "VSPHERE_DNSCONTROLLER_IMAGE=${VSPHERE_DNSCONTROLLER_IMAGE}"
|
||||
echo "KOPS_STATE_STORE=${KOPS_STATE_STORE}"
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Enabling vSphere cloud provider feature flag in kops.
|
||||
export KOPS_FEATURE_FLAGS=+VSphereCloudProvider
|
||||
|
||||
# If set, coredns will be used for vsphere cloud provider.
|
||||
export VSPHERE_DNS=coredns
|
||||
|
||||
|
@ -34,13 +37,15 @@ export VSPHERE_USERNAME=administrator@vsphere.local
|
|||
export VSPHERE_PASSWORD=Admin!23
|
||||
|
||||
# Set TARGET and TARGET_PATH to values where you want nodeup and protokube binaries to get copied.
|
||||
# This should be same location as set for NODEUP_URL and PROTOKUBE_IMAGE.
|
||||
# Urls corresponding to this location are set for NODEUP_URL and PROTOKUBE_IMAGE.
|
||||
export TARGET=jdoe@pa-dbc1131.eng.vmware.com
|
||||
export TARGET_PATH=/dbc/pa-dbc1131/jdoe/misc/kops/
|
||||
|
||||
# Set urls to access nodeup binary and protokube image tar in NODEUP_URL and PROTOKUBE_IMAGE, respectively.
|
||||
export NODEUP_URL=http://pa-dbc1131.eng.vmware.com/jdoe/misc/kops/nodeup/nodeup
|
||||
export PROTOKUBE_IMAGE=http://pa-dbc1131.eng.vmware.com/jdoe/misc/kops/protokube/protokube.tar.gz
|
||||
|
||||
echo "KOPS_FEATURE_FLAGS=${KOPS_FEATURE_FLAGS}"
|
||||
echo "VSPHERE_DNS=${VSPHERE_DNS}"
|
||||
echo "VSPHERE_DNSCONTROLLER_IMAGE=${VSPHERE_DNSCONTROLLER_IMAGE}"
|
||||
echo "KOPS_STATE_STORE=${KOPS_STATE_STORE}"
|
||||
|
|
|
@ -47,6 +47,8 @@ var VPCSkipEnableDNSSupport = New("VPCSkipEnableDNSSupport", Bool(false))
|
|||
// SkipTerraformFormat if set will mean that we will not `tf fmt` the generated terraform.
|
||||
var SkipTerraformFormat = New("SkipTerraformFormat", Bool(false))
|
||||
|
||||
var VSphereCloudProvider = New("VSphereCloudProvider", Bool(false))
|
||||
|
||||
var flags = make(map[string]*FeatureFlag)
|
||||
var flagsMutex sync.Mutex
|
||||
|
||||
|
|
Loading…
Reference in New Issue