Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This pr fixes Kubeedge Installer to support Centos #721

Closed
wants to merge 4 commits into from

Conversation

congfairy
Copy link

@congfairy congfairy commented Jun 19, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
Kubeedge Installer to support Centos
Which issue(s) this PR fixes:
This pr fixes Kubeedge Installer to support Centos #454

Installation steps
Cloud:

  1. git clone git@github.com:congfairy/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
  2. cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
  3. ./kubeedge init
  4. kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Edge:

  1. git clone git@github.com:congfairy/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
  2. Manually copy certs.tgz from cloud host to edge host(s)
    On edge host: mkdir -p /etc/kubeedge
    On cloud host: cd /etc/kubeedge/
    scp -r certs.tgz username@ipEdgevm:/etc/kubeedge
    On edge host untar the certs.tgz file: cd /etc/kubeedge
    tar -xvzf certs.tgz
    3./kubeedge join --edgecontrollerip=xxxx --edgenodeid=testing123 --k8sserverip=xxxx:8080

Here are the console output:
Cloud : After kubeedge init
image

Edge:
image

On the cloud,kubectl get nodes:
image

@kubeedge-bot kubeedge-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 19, 2019
@kubeedge-bot kubeedge-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 19, 2019
@congfairy congfairy changed the title Keadm claire This pr fixes Kubeedge Installer to support Centos #454 Jun 19, 2019
@kevin-wangzefeng kevin-wangzefeng changed the title This pr fixes Kubeedge Installer to support Centos #454 This pr fixes Kubeedge Installer to support Centos Jun 19, 2019
@subpathdev
Copy link
Member

please remove keadm/log

for centos

kubeedge installer ready
cloud ready

edgecore ready

cloud with device model error

edgecontroller ready

cloud and edge are ready

update wget

everything ok

kubeedge centos installer works

delete log
@kevin-wangzefeng
Copy link
Member

The author info in commit history is not correct. Please fix it. You may follow this instruction

/assign @sids-b

@subpathdev
Copy link
Member

to address the previous commit you can actual use this command:

git rebase -i HEAD~3

HEAD~3 means you will use the 4th last commit as rebase base


//Install docker-ce
fmt.Println("stdout is %s", stdout)
dockerInst := fmt.Sprintf("sudo yum install -y --skip-broken docker-ce-%s", stdout)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take care of downgrade and "--allow-change-held-packages" apt-get flag equivalent in yum

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congfairy , have you taken care of this ?

// yum install -y yum-utils
// yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
//yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
// yum-config-manager --add-repo /etc/yum.repos.d/docker.repo
// yum makecache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these comments

func (c *CentOS) addK8SRepositoryAndUpdate() error {
//Get the distribution version
// cmd := &Command{Cmd: exec.Command("sh", "-c", "lsb_release -cs")}
// cmd.ExecuteCommand()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all commented code

cmd := &Command{Cmd: exec.Command("sh", "-c", updtRepo)}
cmd.ExecuteCommand()
updtRepoErr := cmd.GetStdErr()
fmt.Printf("updtRepoErr %s", updtRepoErr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to print incase there is no error. Hence remove this print

fmt.Println("Expected K8S('", k8sComponent, "') version to install is", stdout)

//Install respective K8S components based on where it is being installed
k8sInst := fmt.Sprintf("yum install -y kubeadm-%s kubelet-%s kubectl-%s --disableexcludes=kubernetes", stdout, stdout, stdout)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take care of downgrade and "--allow-change-held-packages" apt-get flag equivalent in yum

if err != nil {
return err
}
time.Sleep(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sleep very much necessary? If not, please remove, or else check if you can reduce it to 1 second.

@@ -50,6 +55,11 @@ func (cu *KubeCloudInstTool) InstallTools() error {
if err != nil {
return err
}
time.Sleep(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this sleep is required. Please remove.

fmt.Println("Edgecontroller started")

return nil
}

//create device model and device CRDS
func (cu *KubeCloudInstTool) createdevicemodel() error {
cmdf := fmt.Sprintf("kubectl create -f $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/devices/devices_v1alpha1_devicemodel.yaml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both kubectl commands will not work if KubeEdge code is not cloned already. keadm init will simply download binaries and not these crd file. Please fix this approach.
Possibly you might have to download only these files in /etc/kubeedge/cloud/conf/ path and in kubectl command access this path to create crd files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean in createdevicemodel function we download devices_v1alpha1_devicemodel.yaml file to /etc/kubeedge/cloud/conf directory firstly and then kubectl create?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congfairy: yes do wget on devices_v1alpha1_devicemodel.yaml and instance.yaml file from source code in /etc/kubeedge/cloud/conf..
Then u can do kubectl apply....

KubernetesGPGURL = "https://packages.cloud.google.com/apt/doc/apt-key.gpg"

KubernetesDownloadURL = "https://apt.kubernetes.io/"
KubernetesGPGURL = "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this as KubernetesGPGURL - >KubernetesUbuntuGPGURL , Modify it where ever it is used.

KubernetesDownloadURL = "https://apt.kubernetes.io/"
KubernetesGPGURL = "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
KubernetesBaseurl = "https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64"
KubernetesGpgkey = "https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this as KubernetesGpgkey - >KubernetesCentOSGPGKey , Modify it where ever it is used.

@samy2019
Copy link
Contributor

@congfairy , Please share your test results as well. I mean the console output after executing "keadm init" in master node and "keadm join" in worker node. Also show proof, if you have deployed deployment pods, secrets and configmap.

@kubeedge-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: sids-b

If they are not already assigned, you can assign the PR to them by writing /assign @sids-b in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@congfairy
Copy link
Author

@congfairy , Please share your test results as well. I mean the console output after executing "keadm init" in master node and "keadm join" in worker node. Also show proof, if you have deployed deployment pods, secrets and configmap.

@samy2019 Yes, I have updated that.

@kubeedge-bot kubeedge-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 21, 2019
@rohitsardesai83 rohitsardesai83 added this to the Backlog milestone Jun 24, 2019
return fmt.Errorf("%s", errout)
err := cmd.StartCmd()
if err != nil {
fmt.Println("in error")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we log the error ? also can we shift to using log package instead of fmt for all logging ?

return fmt.Errorf("%s", errout)
}
fmt.Println(cmd.GetStdOutput())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove space

install = false
}
if install == true {
cmd := &Command{Cmd: exec.Command("sh", "-c", "swapoff -a && kubeadm init --pod-network-cidr 10.244.0.0/16")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congfairy what if , User wants to use calico ,weaver or diffferent Overlay network...It will be better if we dynamically provision which overlay network user wants to use?

fmt.Println("Edgecontroller started")

return nil
}

//create device model and device CRDS
func (cu *KubeCloudInstTool) createdevicemodel() error {
cmdf := fmt.Sprintf("kubectl create -f $GOPATH/src/github.com/kubeedge/kubeedge/build/crds/devices/devices_v1alpha1_devicemodel.yaml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congfairy: yes do wget on devices_v1alpha1_devicemodel.yaml and instance.yaml file from source code in /etc/kubeedge/cloud/conf..
Then u can do kubectl apply....

}

fmt.Println("Expected K8S('", k8sComponent, "') version to install is", stdout)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra space .Its applicable everywhere

@kubeedge-bot kubeedge-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 10, 2019
@sids-b
Copy link
Member

sids-b commented Jul 11, 2019

@congfairy , please resolve the conflicts... The PR looks good to me :)

@congfairy
Copy link
Author

@congfairy , please resolve the conflicts... The PR looks good to me :)
@srivatsav123 @sids-b
Hi,

  1. could you help me to explain how could I resolve the conflicts?
  2. Also ,there is some problem with the code .I would like to transfer the --pod-network-cidr as the parameter for kubeedge init,(then after kubeedge started,users could select to apply flannel or calico yaml file), but it seems that StartK8Scluster function in centosinstaller.go file couldn't get the parameter,could you help me to check the problem ?Appreciate.

@srivatsav123
Copy link
Contributor

@congfairy

  1. For 1 st issue you can refer below you tube video to resolve merge conflicts
    https://www.youtube.com/watch?v=1MVQYSlgXrI
    2.for 2 nd issue, i have shared the below code..Please change it and test it once..
    podnetworkflag

@congfairy
Copy link
Author

congfairy commented Jul 12, 2019

@srivatsav123
This is the remote configuration:
image
I have try to solve the conflict by:

  1. git fetch upstream
  2. git merge origin/keadm-claire
  3. git push origin keadm-claire
    And it outputs that Everything up-to-date
    it seems that I haven't solved the conflicts,is there something wrong?Thanks.
    Also,could you show me the github address for your code?And when user choose "flannel" as the PodNetwork,where chould they define the cidr?
    Thanks!

@rohitsardesai83
Copy link
Collaborator

@srivatsav123
This is the remote configuration:
image
I have try to solve the conflict by:

1. git fetch upstream

2. git merge origin/keadm-claire

3. git push origin keadm-claire
   And it outputs that Everything up-to-date
   it seems that I haven't solved the conflicts,is there something wrong?Thanks.
   Also,could you show me the github address for your code?And when user choose "flannel" as the PodNetwork,where chould they define the cidr?
   Thanks!

@congfairy , can you please try :
git fetch upstream
git rebase upstream/master

@FengyunPan2
Copy link
Member

Is the thing going?

@fisherxu
Copy link
Member

Is the thing going?

Looks like it's been hanging for a long time, and are you interested in fixing it based on the new keadm code? @FengyunPan2

@FengyunPan2
Copy link
Member

@fisherxu Yes, I want to deploy kubeedge on Centos. After getting so many errors by keadm, I find this PR which is handing. Now I have deployed kubeedge on Centos by shell script.
BTW, if @congfairy doesn't mind, I can do it.

@fisherxu
Copy link
Member

After getting so many errors by keadm, I find this PR which is handing.

Now the keadm still doesn't support centos, most func still leave empty... I think you can try it, and now keadm don't install k8s/runtime, so we only need implement the kubeedge related funcs. :)

@FengyunPan2
Copy link
Member

FengyunPan2 commented Mar 10, 2020

PTAL: #1536

@kevin-wangzefeng
Copy link
Member

closing as #1536 is merged
/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants