kubelet.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. Copyright 2014 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // The kubelet binary is responsible for maintaining a set of containers on a particular host VM.
  14. // It syncs data from both configuration file(s) as well as from a quorum of etcd servers.
  15. // It then queries Docker to see what is currently running. It synchronizes the configuration data,
  16. // with the running set of containers by starting or stopping Docker containers.
  17. package main
  18. import (
  19. "fmt"
  20. "os"
  21. "k8s.io/kubernetes/cmd/kubelet/app"
  22. "k8s.io/kubernetes/cmd/kubelet/app/options"
  23. _ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
  24. "k8s.io/kubernetes/pkg/util/flag"
  25. "k8s.io/kubernetes/pkg/util/logs"
  26. _ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
  27. "k8s.io/kubernetes/pkg/version/verflag"
  28. "github.com/spf13/pflag"
  29. )
  30. func main() {
  31. s := options.NewKubeletServer()
  32. s.AddFlags(pflag.CommandLine)
  33. flag.InitFlags()
  34. logs.InitLogs()
  35. defer logs.FlushLogs()
  36. verflag.PrintAndExitIfRequested()
  37. if err := app.Run(s, nil); err != nil {
  38. fmt.Fprintf(os.Stderr, "error: %v\n", err)
  39. os.Exit(1)
  40. }
  41. }